Python malloc issue?

Chuck Swiger cswiger at mac.com
Thu Mar 17 18:32:02 UTC 2011


On Mar 17, 2011, at 7:43 AM, Amit Dev wrote:
> This is using 165MB of memory. I really don't understand where the
> additional memory usage is coming from. [Size of both lists are same]
> 
> Python 2.6.4 on FreeBSD 7.2. On Linux and windows both uses around
> 100mb memory only.

It's possible that Linux and Windows are using Python's malloc, whereas FreeBSD might be using the native PHK or JE malloc.  (And it's not that surprising that different allocation patterns have different results in a garbage-collected environment.)

  http://docs.python.org/library/gc.html

...provides some info; consider importing gc and calling gc.collect() if you want to minimize the RAM needed to hold this big list of strings.

Regards,
-- 
-Chuck



More information about the freebsd-python mailing list