cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Why do you create objects on the free st
Why do you create objects on the free store?
Jun 8, 2013 at 9:31am
Jun 8, 2013 at 9:31am UTC
jasonrobertz357
(56)
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 :)
Jun 8, 2013 at 9:48am
Jun 8, 2013 at 9:48am UTC
keskiverto
(10424)
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.