This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients asvetlov, pitrou, thehesiod, vstinner
Date 2018-05-19.00:48:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526690918.71.0.682650639539.issue33565@psf.upfronthosting.co.za>
In-reply-to
Content
tracemalloc doesn't track memory leaks. It tracks memory allocations.

I'm not sure that you are using tracemalloc properly. I suggest you to enable tracemalloc as soon as possible, take snapshot frequently (eg. at each iteration) and write them on disk, and later compute differences between snapshots.

You may want to try my tracemallocqt UI to analyze snapshots:
http://pytracemalloc.readthedocs.io/tracemallocqt.html

What matters to track a memory leak is to find the largest positive difference.

I don't know what allocated "21 memory blocks: 4.7 KiB" at your "raise" line. tracemalloc tracks *all* memory allocated by Python, including very private internal structures, like the dictionary used for "interned" strings. Sometimes, results can be surprising, but it should be simpler if you focus on differences between two snapshots.

If you have a leak per iteration, after 10 or 25 iterations, the difference should become obvious.
History
Date User Action Args
2018-05-19 00:48:38vstinnersetrecipients: + vstinner, pitrou, asvetlov, thehesiod
2018-05-19 00:48:38vstinnersetmessageid: <1526690918.71.0.682650639539.issue33565@psf.upfronthosting.co.za>
2018-05-19 00:48:38vstinnerlinkissue33565 messages
2018-05-19 00:48:38vstinnercreate