memory leak with large list??

Tim Peters tim.one at comcast.net
Wed Jan 29 22:00:43 EST 2003


[Stanley]
> ...
> This brings up two questions for me:
>
> 1. Since several people suggested it, I've been looking at Numeric
> python, which looks really great.  The question is, are there any
> disadvantages to using Numeric over using the array module.  It seems
> that array is just a poor cousin of Numeric.  So I assume that either
> the array module has some advantage (speed or memory wise) over
> Numeric, or it exists simply because Numeric is not a part of the base
> python distribution.  So is there any reason not to use Numeric??

The array module existed long before Numeric did, and I doubt their
audiences even overlap.  "array" is just a storage-efficiency gimmick, while
Numeric aims at fast numeric computation.  Computation with array.array
objects is usually *slower* than using Python lists, since the raw bytes in
an array.array have to be wrapped in a Python object every time they're
sucked out, and the wrapper stripped again whenever they're stored.

The only disadvantage to using Numeric would be if you wanted to distribute
your app, and to people who balked at installing Numeric.  It may also cut
back on the number of people willing to help you develop you're app, if it's
Open Source, simply because many Python users don't know anything about
Numeric.

> 2. Is there any nice way to profile memory in python?

No.  Python isn't the operating system, and only the OS knows "for real" how
the OS passes out memory.  Python is several layers removed from those
truths.






More information about the Python-list mailing list