News for hackers. Stuff that matters.
Re:Tracking Down a Python Memory Leak by dekhn on Wednesday December 07, 2016 @03:15PM (#13125805)
I've used the gc module, with get_referers and get_referents, to track down various leaks. This only really helps with python-allocated object.

It's trivial to end up with an unexpected strong reference. Weak references are the right way to deal with cache objects, imho.

Re:Tracking Down a Python Memory Leak by dom0 on Wednesday December 07, 2016 @07:08PM (#13127399)
> Weak references are the right way to deal with cache objects, imho.

Yet, I disagree ;) Whether a weakref is the correct thing to use or not depends entirely on the purpose of the cache. I often find myself using caches were weakref would not be very useful, because it would cool the cache a lot.

Re:Tracking Down a Python Memory Leak by bbernard on Wednesday December 07, 2016 @03:51PM (#13126102)
Interesting approach!

It's hard to tell the difference between a real memory leak and Python objects being accumulated infinitely in memory - at least if we rely only on the memory use of a process. That's why we need to use either gc or objgraph as a first step.