Memory allocation

Peter Hansen peter at engcorp.com
Mon Sep 22 19:11:14 EDT 2003


"Batista, Facundo" wrote:
> 
> #- Knowing how much memory the object consumes will not help you with
> #- that, at least in general.  The object could easily be changed in a
> #- dozen ways yet still consume the same amount of memory.
> 
> No, sorry. Knowing how much memory consumes, gives me if it's a viable
> solution.

Hmm... you mean the memory consumption had nothing to do with detecting
the change?  You just want to know if holding the pickled object in 
memory is viable?  If that's what you mean, I must be missing something...
a pickle is just a serialized (i.e. flat) representation of the data
as a series of bytes, right?  In other words, a string?  So call len()
on it...  (as I said, that sounds too easy so I must be missing something).

> But, there is a way to know the memory consumption?

Not really, although I suspect there have been past postings to the 
newsgroup (maybe check the archives) in which people have experimented
with partial solutions to this problem.  It's not generally something
that seems to come up very often.

-Peter




More information about the Python-list mailing list