Thanks Dan for the detailed reply. I suspect it is related to FreeBSD
malloc/free as you suggested. Here is the output of running your
script:
[16-bsd01 ~/work]$ python strm.py --first
USERPID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
amdev 6899 3.0 6.9 111944 107560 p0 S+
On Wed, Mar 16, 2011 at 8:38 AM, Amit Dev wrote:
> I'm observing a strange memory usage pattern with strings. 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(10):
> .
On 3/16/2011 3:51 PM, Santoso Wijaya wrote:
??
Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit
(AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> L = []
>>> for i in xrange(10):
... L.append(str(i) * (1000 / len(
On Wednesday, March 16, 2011 2:20:34 PM UTC-4, Amit Dev wrote:
>
> sum(map(len, l)) => 8200 for 1st case and 9100 for 2nd case.
> Roughly 100MB as I mentioned.
The two lists used approximately the same memory in my test with Python 2.6.6
on Windows. An implementation detail such as this
??
Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> L = []
>>> for i in xrange(10):
... L.append(str(i) * (1000 / len(str(i
...
>>> sys.getsizeof(L)
824464
>>> L =
sum(map(len, l)) => 8200 for 1st case and 9100 for 2nd case.
Roughly 100MB as I mentioned.
On Wed, Mar 16, 2011 at 11:21 PM, John Gordon wrote:
> In Amit Dev
> writes:
>
>> I'm observing a strange memory usage pattern with strings. Consider
>> the following session. Idea is to create
In Amit Dev
writes:
> I'm observing a strange memory usage pattern with strings. 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(10):
> ... l.append(str(i) * (1000/
I'm observing a strange memory usage pattern with strings. 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(10):
... l.append(str(i) * (1000/len(str(i
This uses around 100M