-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: BijumonPooyappilly
Message 8 in Discussion
Hi
The difference
between storing in stack and heap can be explained in this way also.
All the Primitive Data Types (for example, in
java, byte, short, int, long, float, double, char,
and boolean) are stored in stack. All others are
stored in heap. For primitive data types, the size (memory used) will be same.
But for other data types(array and others), the size (memory used) will be
changing. We use NEW operator to allocate the memory for these data types.
In a single sentence, those data types, whose
memory is allocated using the NEW operator, are stored in heap and all
others (the primitive data types) are stored in stack.
Regards, Bijumon
www.atinav.com
----- Original Message -----
From:
Swimmy
To: MumbaiUserGroup
Sent: Thursday, August 11, 2005 3:39
PM
Subject: Re: diffrence between storing
with Stack and Heap?
New Message on MumbaiUserGroup
diffrence
between storing with Stack and Heap?
Reply
Reply to Sender Recommend
Message 6 in
Discussion
From: Swimmy
Dear Tokmuni,
Hopefully this explanation helps you to understand the
difference between storing with stack and heap.
.NET has 2 major variable types:
1. Value Type:
Value type represents simple data storage located on
stack. ie., When data is assigned to a value type the
actual data is stored in the variable on the stack.
Stack is comparitively small memory area in which
data of fixed size is stored. eg., An integer or decimal
value will need the same number of bytes to store their
data, regardless of their actual value. This means that
the location of such value can be efficiently
determined.
2. Reference Type:
Reference Type represent custom storage on
Managed Heap. ie., When a data is assigned to a
reference typeonly a reference is stored in the
variable (stack) and the actual data is stored on the
Managed Heap.
Reference types donot have a fixed size. eg.,a string
could vary in size from 2 bytes to close to all memory
available on a system. The dynamic size of reference
types means that the data they contain is stored on the
heap rather than stack, however, the address of the
reference type (ie., the location of the data on the
heap) does have a fixed size, and so can be stored
on the stack.
View other groups in this
category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]