3 ms·
smart pointers are better than GC or do it yourself imo. smart pointers and RAII allow me to explicitly model ownership and lifetime in a non imperative way. I
by dicroce 12y ago
smart pointers are better than GC or do it yourself imo.
smart pointers and RAII allow me to explicitly model ownership and lifetime in a non imperative way. In addition, I am not subject to arbitrary GC runs with non deterministic amounts of work to do. Instead, objects simply go away as they are no longer needed in a completely deterministic way.
- evincarofautumn 12y agoNaïve reference counting is deterministic, but it may also do an arbitrary amount of work on a deallocation because it reclaims objects eagerly. Deferred/incremental reference counting is much more suitable for, say, games, which is what it sounds like you’re thinking of.
- pjmlp 12y agoI guess you never experienced a stop-the-world caused by cascading destructors.