I 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.
Of course not, these mechanisms are so that other people can manage your memory :)
What, you never deallocated the bit of memory holding where you put your keys before collecting the keys?
Don'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.