How to get memory size/usage of python object
Remco Gerlich
remco at gerlich.nl
Thu Jan 10 03:53:47 EST 2008
Hi,
The only list without references to other objects in it is [ ].
0, 1, 2, etc are objects. Every value in Python is a reference to an object.
Remco
On Jan 10, 2008 9:14 AM, Santiago Romero < sromero at gmail.com> wrote:
>
> > Would you care to precisely define "REAL size" first? Consider:
> >
> > >>> atuple = (1, 2)
> > >>> mylist = [(0, 0), atuple]
> >
> > Should sizeof(mylist) include sizeof(atuple) ?
>
> No, I'm talking about "simple" lists, without REFERENCES to another
> objects into it.
>
> I mean:
>
> lists = [ 0, 1, 2, 3, 4, (1,2), 3]
>
> or
>
> array = [ [0,0,0,0,0,0,0], [1,1,1,1,2,1,2], ... ]
>
> Maybe I can "pickle" the object to disk and see the filesize ... :-?
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080110/56cdfb89/attachment-0001.html>
More information about the Python-list
mailing list