4 ms·
Isn't it simply a form of garbage collection? Instead of garbage collecting all the unused objects at random moments, an object is garbage collected as soon as
by troebr 13y ago
Isn't it simply a form of garbage collection? Instead of garbage collecting all the unused objects at random moments, an object is garbage collected as soon as it goes out of scope.
The way I understand it, no garbage collection means you take care of cleaning after yourself, whereas garbage collectors do it for you. It sounds like what he calls resource acquisition.
- plorkyeran 13y agoGarbage collection is not a synonym for automatic memory management.
- shmerl 13y agoC++ has wider options managing resource acquisition. Scope is just one case. https://en.wikipedia.org/wiki/Smart_pointer#C.2B.2B_smart_pointers https://en.wikipedia.org/wiki/Smart_pointer#C.2B.2B_smart_po...
- rgo 13y agoNo. I think cleaning up, manually or automatically, after objects go out of scope is not the same as garbage collecting. "Garbage" here implies objects that linger beyond their usage scope, from construction to destruction, and now have become garbage taking up memory that can only be reclaimed by an extraneous routine, ie the GC.