Help with finding how much memory a variable is using

Steve Purcell stephen_purcell at yahoo.com
Fri Feb 23 12:48:09 EST 2001


Rich Somerfield wrote:
> I am generating a huge, huge list of data (cant think of a decent way to
> reduce the required storage size and have it in a usable form).  Everytime i
> try to keep this list for future derivations I get a memory problem from
> Windows (effectively terminating my python script).
> 
> I presume this is because of the huge list.  Is it possible to find out the
> amount of memory a variable [not a type of the variable, the actual data
> contained within the variable] is taking up?

A huge, huge in-memory list is very likely to be the cause of such a memory
problem! <wink>

Compression isn't going to help you much if the list is so big that even
a tenth of its size would still be too big.

Post some more technical information and I'm sure you'll get more helpful
suggestions/alternatives than you could have wished for*.

-Steve

* or wanted

-- 
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Get servlets at http://pyserv.sourceforge.net/
"Even snakes are afraid of snakes." -- Steven Wright




More information about the Python-list mailing list