3 ms·
Hunting memory leaks in Python
- wave 18y ago"...Python is a garbage-collected language! How can it leak memory?... The trouble is that sometimes an object created by the test is referenced from a global variable, and that keeps it from being collected"
- pmjordan 18y agoSo, 'zope.app.error.error._temp_logs' was filling up with data. So that's a memory leak in Zope, not Python. The article does show a graphical, partly automated technique for tracking this stuff down though, which is nice. Really though, it's just another example of common mistakes from static/global variables or singletons.
- GrandMasterBirt 18y agoI found a few thread leaks in my work's java suite. Unfortunately it was due to the fact that our thread monitor (good thing we put it in) started spazing out. I asked "why so many threads", and found the answer "because we created daemon threads and lost reference to them, there was nothing to stop any of them, so they kept getting created, and re-created, etc, and they all kept running for the entire suite." Now if I could figure out why rebuilding the database takes 7 minutes vs 20 seconds that it used to take i'd start really saving time during dev.