3 ms·
How is garbage collected?
by amelius 6y ago
How is garbage collected?
- moonchild 6y agoIt's not. If you implement this strategy in a garbage collected language, you can end up with use-after-frees or double frees (though with the advantage of type safety—if you use a handle of type Foo after freeing it, you'll never stomp on the memory of an object of type Bar, for any Bar≠Foo).
- deleted 6y ago[deleted]
- omginternets 6y agoI believe this was C, so presumably it’s not?
- amelius 6y agoIn C garbage is collected "manually", by calling malloc and free. If you design your own heap, you also have to design the memory management around it.