3 ms·
Sure, if you’re using pre-1990’s memory management. Best practices have evolved far beyond the explicit use of malloc & free and unsafe string handling. Most p
by mailslot 7y ago
Sure, if you’re using pre-1990’s memory management. Best practices have evolved far beyond the explicit use of malloc & free and unsafe string handling.
Most popular dynamic languages don’t use garbage collection under the hood anyway. In Python and many other runtimes, it’s primarily reference counted.
- ygra 7y agoPython still uses mark and sweep occasionally to clean up structures where reference counting fails.
- mailslot 7y agoIt has optional cycle detection, yep. But... you could also just spend a couple of minutes to not have cyclic references.
- mantap 7y agoClosures are objects that can participate in cycles. And the lifetime of closures is very hard to track statically.
- mailslot 7y agoThey are and they should be used responsibly. I’d argue sparingly also.
- Dylan16807 7y ago"A couple of minutes" Just a little bit overconfident.
- kllrnohj 7y agoPython largely only gets away with ref counting because it doesn't support concurrent access. The GIL means it's basically single-threaded ref counting, which is much cheaper than an actual atomic ref count (like std::shared_ptr) Scattering atomic ref counts everywhere gets extremely expensive very quickly.