5 ms·
laughs in "never needed any of these weird mechanisms to manage my own memory"
by jheriko 3y ago
laughs in "never needed any of these weird mechanisms to manage my own memory"
- recursive 3y agoClassic blub programmer looking up. https://wiki.c2.com/?BlubParadox https://wiki.c2.com/?BlubParadox
- ColonelPhantom 3y agoI mean, when coding memory management by hand in C or C++ (although C++ of course has things like RAII and smart pointers which simplify life a lot), you do need to have similar mechanisms within your own head. Otherwise you'll get all sorts of fun stuff like pointer aliasing, use-after-free, or what-have-you.
- oconnor663 3y agoOf course not, these mechanisms are so that other people can manage your memory :)
- Tyr42 3y agoWhat, you never deallocated the bit of memory holding where you put your keys before collecting the keys?
- mtlmtlmtlmtl 3y agoDon't forget to zero the memory first. If you don't, the keys may still be there depending on the allocator. Also, be careful about how you zero it, so the compiler doesn't optimise it out.