Help: sizeof() and reference in python?

Gene Chiaramonte gchiaramonte at ibl.bm
Mon Mar 6 03:44:54 EST 2000


> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Fredrik Lundh
> Sent: Sunday, March 05, 2000 4:51 PM
> To: python-list at python.org
> Subject: Re: Help: sizeof() and reference in python?
> 
> 
> Gene Chiaramonte <gchiaramonte at ibl.bm> wrote:
> > I guess I should have been more specific.
> 
> unfortunately, that doesn't help in this case ;-)
> 
> > 1 - I am trying to get the size of an object in bytes to 
> monitor how much
> > memory a list or object occupies.
> 
> you can't.
> 
> (well, you can always do it yourself, using a dictionary
> to map type(object) to approximate size of object. see
> the struct definitions in Include/*.h for more info on how
> the basic types are implemented).

Good idea.

> 
> > 2 - I am trying to get the pointer to the memory address of an object.
> Much
> > like the array objects buffer_info(), where the second item in the
> returned
> > tuple is the pointer to the memory address of the first element of the
> > array.
> 
> since you cannot do anything with it anyway, why not
> just use id(object).  it's a pretty good approximation...

Thanks.

> 
> </F>
> 
> <!-- (the eff-bot guide to) the standard python library:
> http://www.pythonware.com/people/fredrik/librarybook.htm
> -->
> 
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list