Hacker News new | ask | show | jobs
by Izkata 392 days ago
There's already a global:

  import gc
  gc.disable()
So I imagine putting more in there to remove objects from the tracking.
1 comments

That can go a long way, so long as you remember to manually GC the handful of things you do care about.
Is 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__()?
Also, 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
And 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.