Re: How to get memory size/usage of python object

2008-01-10 Thread Santiago Romero
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

Re: How to get memory size/usage of python object

2008-01-10 Thread Remco Gerlich
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 [EMAIL PROTECTED] wrote: Would you care to precisely define REAL size first? Consider:

Re: How to get memory size/usage of python object

2008-01-10 Thread Steven D'Aprano
On Thu, 10 Jan 2008 00:14:42 -0800, Santiago Romero 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

How to get memory size/usage of python object

2008-01-09 Thread Santiago Romero
Is there a way to check the REAL size in memory of a python object? Something like print sizeof(mylist) or print sizeof(myclass_object) or something like that ... Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get memory size/usage of python object

2008-01-09 Thread Fredrik Lundh
Santiago Romero wrote: Is there a way to check the REAL size in memory of a python object? in standard Python, without reading the interpreter source code carefully, no. to get an approximate value, create a thousand (or a million) objects and check how much the interpreter grows when you

Re: How to get memory size/usage of python object

2008-01-09 Thread Tim Chase
Sion Arrowsmith wrote: Santiago Romero [EMAIL PROTECTED] wrote: Is there a way to check the REAL size in memory of a python object? Something like print sizeof(mylist) [ ... ] Would you care to precisely define REAL size first? Consider: atuple = (1, 2) mylist = [(0, 0), atuple]

Re: How to get memory size/usage of python object

2008-01-09 Thread Sion Arrowsmith
Santiago Romero [EMAIL PROTECTED] wrote: Is there a way to check the REAL size in memory of a python object? Something like print sizeof(mylist) [ ... ] Would you care to precisely define REAL size first? Consider: atuple = (1, 2) mylist = [(0, 0), atuple] Should sizeof(mylist)