3 ms·
There's already a global: import gc gc.disable() So I imagine putting more in there to remove objects from the tracking.
by Izkata 1y ago
There's already a global:
import gc
gc.disable()
So I imagine putting more in there to remove objects from the tracking.
- kstrauser 1y agoThat can go a long way, so long as you remember to manually GC the handful of things you do care about.
- MonkeyClub 1y agoAnd then we're back to manual memory management. At least the objects get instantiated automatically, and you don't need to malloc() them into existence yourself; I guess that's still something.
- westurner 1y agoIs there a good way to add __del__() methods or to wrap Context Manager __enter__()/__exit__() methods around objects that never needed them because of the gc? Hadn't seen this: import gc gc.disable() Cython has __dealloc__() instead of __del__()?
- westurner 1y agoAlso, there's a recent proposal to add explicit resource management to JS: "JavaScript's New Superpower: Explicit Resource Management" https://news.ycombinator.com/item?id=44012227 https://news.ycombinator.com/item?id=44012227