[Python-Dev] Reduce memory footprint of Python (original) (raw)

Stefan Behnel stefan_ml at behnel.de
Sun Oct 6 18:11:19 CEST 2013


Benjamin Peterson, 06.10.2013 17:41:

2013/10/6 Victor Stinner:

unittest doesn't look to release memory (the TestCase class) after the execution of a test. Is it important to optimize unittests for memory usage?

Maybe "optimise" isn't the best word, but test suites can sometimes be huge and I can't see a reason to keep an old TestClass instance around after all its tests have run. So why not free it? If the tests do any intermediate caching, it's likely to happen at that level (or at the module level, but that's the user's decision).

Sure, if memory matters, there's tearDownClass() for manual cleanup, but why require users to care when we otherwise provide automatic memory management everywhere else? It certainly improves the default setup.

Stefan



More information about the Python-Dev mailing list