4 ms·
You do know that function stack frames are dynamically allocated (just not from the heap in most C and C++ implementations).
by aidenn0 11y ago
You do know that function stack frames are dynamically allocated (just not from the heap in most C and C++ implementations).
- Namrog84 11y agoMaybe he is coming from the fact that lots of things still leak memory this day and age. And you tend to not leak memory when you avoid dynamic allocation? Though you can still build up crud depending upon the system.
- jheriko 11y agoin a sense yes, but its not a realistic way to use the term. what happens is that the stack is once dynamically allocated up-front when the thread is created and an index into that blob of memory is incremented and decremented as appropriate (stack pointer). you can call that allocation, and it would be accurate but its not what i meant at all. it also avoids growing your memory consumption and doesn't impact memory budgets no matter how much stack you try and use (you will overflow it instead... and will need to allocate a bigger budget upfront for the stack with a compiler flag)