3 ms·
You can think of two levels of deallocated memory: deallocated just inside the app, and fully deallocated towards the OS. Only the fully deallocated towards the
by 323 4y ago
You can think of two levels of deallocated memory: deallocated just inside the app, and fully deallocated towards the OS. Only the fully deallocated towards the OS will crash.
When you deallocate small amounts of memory, the underlying C library allocator will keep the deallocated memory around and not return it to the OS in case you need a similar sized piece of memory soon.
- ncmncm 4y agoNot correct. It is very rare for memory ever to be freed to the OS before process exit. Malloc never does. And, zeroing the memory, if code later uses it like a pointer, that will be null and the use will trap.