difference bwn stack and heap?????
give me a better understanding of stack and heap ??????
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
naimer kallisPosted Jan 5, 2015, 1:05 AM
Naimer
VulpesPosted Aug 20, 2014, 6:48 AM
Value types are not always stored on the stack.
For example, if they are:
1. Static or instance fields of reference types; or
2. Static fields of value types,
then they are stored on the heap.
Abhay ShankerPosted Aug 20, 2014, 6:02 AM
The stack is a data structure in memory used for storing items in a last-in, first-out manner (LIFO). The stack contains both local variables and the call stack. In C#, value types are stored on the stack.
The heap or managed heap is a data structure in memory where all objects—reference types—are stored. When an object is instantiated, the object is stored on the heap as a block of data containing its data members. Then, the memory address of the block is stored in a reference variable. Future references to the object are through the reference variable.
Check below links for more details:-
http://csharpcomputing.com/Tutorials/Lesson6.htm
http://www.albahari.com/valuevsreftypes.aspx
VulpesPosted Aug 20, 2014, 4:54 AM
http://www.c-sharpcorner.com/UploadFile/rmcochran/csharp_memory01122006130034PM/csharp_memory.aspx
http://www.c-sharpcorner.com/UploadFile/rmcochran/csharp_memory2B01142006125918PM/csharp_memory2B.aspx
http://www.c-sharpcorner.com/UploadFile/rmcochran/chsarp_memory401152006094206AM/chsarp_memory4.aspx
http://www.c-sharpcorner.com/UploadFile/rmcochran/csharp_memory_401282006141834PM/csharp_memory_4.aspx