Why do you create objects on the free store?

Is it because if you're done with that object, you can free the that memory which objects created on the stack can't? I've just finished the chapter about pointers recently in my book :)
The size of stack memory is limited compared to the heap.

The lifetime of stack variables is limited to their scope.

Stack memory is essentially reserved during compilation. Unforeseen runtime needs must use dynamic allocation.
Topic archived. No new replies allowed.