Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi all,

What is the difference between Heap and free store in detail.Also please tell

me the details about Heap and stack.

Thanks in advance
Posted

Heap and Free-Store are the same thing.

Heap: Memory store available for dynamic memory allocation at run-time. This is as large as your virtual memory system if your os supports virtual memory, or the available RAM for your machine.

Stack: In this context, the more appropriate name is "Call Stack". This is a much smaller amount of memory than the Heap, which keeps track of the program execution chain. Each function call will add a stack frame on the stack and continue to grow with each nested function call. As function calls return, stack frames are popped off. local variables for functions are allocated with the stack based memory. A stack overrun occurs when you reach the end of the allocated space for the current call stack.
 
Share this answer
 
Comments
Wonde Tadesse 30-Nov-11 20:45pm    
5+
The difference is the same as between food and free lunch. :-)
Beyond jokes: same thing, see http://en.wikipedia.org/wiki/Free_store_%28programming%29[^].

I cannot really tell you "detail" about heap and stack. Both are so fundamental concepts in programming, so they are not a part of any technical knowledge. They are part of education. I could quickly write about it, but it makes no sense: it would be a whole article beyond the format of CodeProject Questions & Answers, and you would not really understand it without serious practical exercise. By the same reason I don't want to give you references. You really want to read a book and solve some related problems.

Really, if you don't understand these concept and usage, you do not do real programming, or do it like you were blind-folded.

—SA
 
Share this answer
 
v3
Comments
Wonde Tadesse 30-Nov-11 20:45pm    
5+
Sergey Alexandrovich Kryukov 30-Nov-11 20:56pm    
Thank you, Wonde.
--SA
Hi,

Take a look at this article that I wrote ;) :

basic-stuff-memory-organization/[^]


Best regards.
EL GAABEB.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900