pytest
pytest copied to clipboard
Memory usage increases rapidly as the number of tests grows
Hi !
I am witnessing this memory usage increase on fpdf2, using memunit: https://github.com/PyFPDF/fpdf2/issues/641
A contributor also mentioned that it was reported on StackOverflow some years ago:
https://stackoverflow.com/questions/20900380/py-test-excessive-memory-usage-with-large-number-of-tests
In short: for a tests suite with ~1000 unit tests, I have witnessed an increase in memory usage of more than 10MB for 40 unit tests added.
Is this surprising to you, or expected?
And secondly, could there be optimizations to make, in pytest or in my tests suite, in order to lower this memory usage?
I have searched the issues & discussions history about this but found nothing anwering those questions:
- https://github.com/pytest-dev/pytest/issues?q=memory+leak
- https://github.com/pytest-dev/pytest/discussions?discussions_q=memory+usage
I wonder how much this changes with the -s flag or disabling the logging plugin
I wonder how much this changes with the -s flag or disabling the logging plugin
On my computer, measures were similar when using -s or -p no:logging, no big difference.
Is this surprising to you, or expected?
Definitely something is fishy, we routinely have thousands of tests in our suites at work, and we don't see a memory growth like that.
Nope
More than 100k tests is a entirely different league than this