getting memory usage of varaibles

Erik python at lucidity.plus.com
Tue May 2 19:01:46 EDT 2017


On 02/05/17 23:28, Larry Martell wrote:
>>> Anyone have any thoughts on how I can monitor the variables' memory
>>> usage as the script runs?
>>
>> This is application-specific, but sometimes it helps to look at the
>> objects' types, or even their values.
>
> The types are dict and list, so they are not very useful, nor were the values.

Given your description, I would hazard a guess that you have a circular 
reference somewhere (such that some objects may remain referenced after 
you believe they should have been discarded). You could _probably_ break 
that circle with some carefully placed 'del' statements somewhere - but 
you'd need to analyze your data structures (and closures) first to see 
if that's the case.

E.



More information about the Python-list mailing list