memory leak with large list??

Terry Reedy tjreedy at udel.edu
Sun Jan 26 02:39:43 EST 2003


> > >Each object has at least a pointer to the object's type object,
and a
> > >refcount, for at least 8 bytes of overhead.  So a float object
consumes at
> > >least 16 bytes.
> > Why do you need to duplicate the type pointer for all those? I.e.,
if
> > you allocated space in decent-size arrays of object
representations without
> > type pointer, and just reserved a header slot in front of the
array, [snip]

Because in Python, each object is a separate object, and because lists
are heterogeneous.  Anyone who wants to work with 12 mil floats should
almost certainly be using Numerical Python, which does have homegenous
arrays of native floats (8 bytes per) along with C functions to do
most common 'base' computatons.

Terry J. Reedy






More information about the Python-list mailing list