Stack, Heap, Mfc



As I understand it we have to take in to account what is put on the stack
and what
is put on the heap. Since our classes are instantiated from either a
document or view
decendant does this not mean that all memory will be on the heap because our
document
and view classes will be on the heap?

If we have a class1 and instantiate it from a CDocument
class1 myClass
It is not directly put on the heap with 'new' but it will still be a part of
CDocument class decendent
which is on the heap so the memory for the instance of myClass will also be
on the heap.

Am I missing something or can I conclude that no memory used for mfc objects
is placed on
the stack.

Also, if functions are placed on the stack when they are used and the stack
is a limited area of
memory. How can you account for recurring functions that will increase the
area of the stack used
each time the function is called. How can you stop the stack from over
flowing.

Thanks for any advice
James


.



Relevant Pages

  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: run-time vs compile-time
    ... > offset related to some location (like stack base) somewhere. ... > offset from heap to pi. ... When you allocate an int on the heap, it is allocated at address 1. ... application has a given amount of memory it can use as it wishes. ...
    (comp.lang.cpp)
  • Re: Error Raising and Memory in VB (general question)
    ... > object is terminated go out of scope, and the memory is also released. ... But why are you saying it uses stack? ... I think we are dealing with heap memory here. ... "COM's IMalloc allocator: ...
    (microsoft.public.vb.general.discussion)
  • Re: Linked List & Dynamic Memory Allocation
    ... Both of you mentioned stack and heap in this ... when I call malloc it uses heap to allocate memory. ... if you have an integer pointer object that lives beyond this scope and you had: ...
    (microsoft.public.vc.mfc)
  • Re: How does managed code work?
    ... Does it work the same way as the native stack with a frame pointer that is the head of a linked list of stack frames where each time we enter a function we create a new stack frame in which new variables are pushed and each time we exit a function the entire stack frame is popped? ... Can someone point me to a discussion of the managed heap? ... How does it prevent memory leaks that occur in COM when two objects reference each other and keep the others reference count nonzero? ... Because objects don't go out of scope, ...
    (microsoft.public.dotnet.languages.csharp)