Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am exploring more in depth how c++ handles memory management. More specifically I am trying to figure out the relationship between stack frames and the heap.

I have so far been able to find out that the stack frame is the local segment we appropriate to an individual function. In assembly language it is done through the manipulation of the base pointer that stack pointer and reserving a slot in the stack segment big enough to hold your local variables. Then any parameters there may be you simply push and pop off the stack. I am wondering if this is correct.

The heap used by a program I have been unable to find any concrete information about.

I was wondering if anyone can explain how these work in c++ possibly in assembly language as well for use as a reference or if anyone can provide me with links to resources were I might be able to learn about these.

Best Regards, Bear

share|improve this question
I don't think this is a game-development question. There are loads of resources on the net with this information, and explaining it through a public Q&A website is a bit redundant I think. Just google "C and the stack" or something. I don't mean to be offensive, but I really feel this isn't the best way for you to get your information. – maul Feb 14 at 15:12
I wonder though, architectures( and the understanding of how memory/calls/cpu caches/etc work) in games are also important. Im not sure if his question is completely misplaced. – Sidar Feb 14 at 16:00
Both the question and this "answer" are misplaced. Yes, knowing about the stack vs the heap is important to game development, but it's not something a game developer would be able to answer better. Additionally, even if there are "loads of resources" on the net, it's still nice to have concise answers here on SE (in this case over at stack overflow), making it the go-to reference for developers. – Byte56 Feb 14 at 16:28
1  
You should be able to learn a great deal here: stackoverflow.com/search?q=stack+vs+heap – Byte56 Feb 14 at 16:28
More appropriate for the programmer's stack, IMO. It's also just part of the larger question of "where does data live?" which involves static, initialized, uninitialized, code, virtual pages, CPU registers, GPU/coprocessor memory, architectures like PPC, it goes on forever. – Patrick Hughes Feb 14 at 16:54
show 5 more comments

closed as off topic by Byte56, Patrick Hughes, Sean Middleditch, Trevor Powell, bummzack Feb 15 at 7:25

Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.