4 ms·
Sure, the stack as storage never shrinks, but it's constantly reused for different kinds of objects. Having said that dynamic memory is also rarely given back t
by leni536 2y ago
Sure, the stack as storage never shrinks, but it's constantly reused for different kinds of objects. Having said that dynamic memory is also rarely given back to the OS, and you are lucky to get a segfault from a use-after-free there too. This is not the problem.
The problem is accessing objects that are outside of their lifetime, not storage. The objects are gone, even if the storage might still be there.
- mgaunard 2y agoThat's not as big of a problem as using more resources than you need.