In the third approach, dynamic memory allocation, all objects are really, as far as the activation record stack is concerned, really just pointers.
Because pointers have a fixed size, regardless of what it is they are pointing to, only enough space for a pointer need be stored on the stack, and this can easily be determined at compile time. The actual data storage is allocated on the heap during run-time.
This is the approach used in Smalltalk, Java, Object Pascal, and Objective-C.
Now, pointer allocation is one thing, but memory recovery is something entirely different. Some languages, such as Object Pascal, require the user to explicitly free object values. Other languages, such as Smalltalk and Java, use a garbage collection system to recover unused memory.