Originally posted by DavidBrown
View Post
Garbage-collected languages can't leak memory by completely losing track of it, but you can write programs that hold onto memory longer than necessary, thereby becoming bloated over time.
Perhaps more dangerous are pseudo-garbage collected languages that simply rely on refcounting, like old Python or people getting carried away with C++'s shared_ptr<>. In those cases, the hazards are indirect cyclic references. In C++, you can use weak_ptr<> to break the cycles, but it means you need to pay attention to what you're doing and not just use shared_ptr<> with abandon. I'm reading that Python can now detect & handle indirect cyclic references, which is good news.
Leave a comment: