Python malloc issue?
Amit Dev
amitdev at gmail.com
Thu Mar 17 15:14:25 UTC 2011
I'm observing a strange memory usage pattern with python strings on
Freebsd. Consider
the following session. Idea is to create a list which holds some
strings so that cumulative characters in the list is 100MB.
>>> l = []
>>> for i in xrange(100000):
... l.append(str(i) * (1000/len(str(i))))
This uses around 100MB of memory as expected and 'del l' will clear that.
>>> for i in xrange(20000):
... l.append(str(i) * (5000/len(str(i))))
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.
Regards,
aMit
More information about the freebsd-python
mailing list