4 ms·
I am surprised that call stacks aren't mentioned. The call stack is a great way to free up memory that's no longer being used by a function. Maybe it was too ob
by habitue 2y ago
I am surprised that call stacks aren't mentioned. The call stack is a great way to free up memory that's no longer being used by a function. Maybe it was too obvious to include?
- ReleaseCandidat 2y agoThat doesn't solve the "use after free" problem, so not memory safe (as long as not combined with something else).
- EVa5I7bHFq9mnYK 2y agoWhat is the "use after free" problem? A function leaves the computed result on the stack or modifies data higher in the stack. There are no pointers, nothing to free.
- deleted 2y ago[deleted]
- habitue 2y agoIf you return a pointer from a function that points to a stack local variable, it'll be invalid. Generally this is easy ish to detect though.
- EVa5I7bHFq9mnYK 2y agoIn this stack only scheme there are no pointers. Function leaves its returned data at the top of the stack.