This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dalke
Recipients dalke, pitrou
Date 2008-08-09.11:26:48
SpamBayes Score 6.4165165e-06
Marked as misclassified No
Message-id <1218281216.04.0.602641395217.issue3531@psf.upfronthosting.co.za>
In-reply-to
Content
You're right.  I mistook the string implementation for the list one 
which does keep a preallocated section in case of growth.  Strings of 
course don't grow so there's no need for that.

I tracked the memory allocation all the way down to 
obmalloc.c:PyObject_Realloc .  The call goes to realloc(p, nbytes) which 
is a C lib call.  It appears that the memory space is not reallocated.

That was enough to be able to find the python-dev thread "Darwin's 
realloc(...) implementation never shrinks allocations" from Jan. 2005, 
Bob Ippolito's post "realloc.. doesn’t?" 
(http://bob.pythonmac.org/archives/2005/01/01/realloc-doesnt/ ) and Issue1092502 .

Mind you, I also get the problem on FreeBSD 2.6 so it isn't Darwin 
specific.
History
Date User Action Args
2008-08-09 11:26:56dalkesetrecipients: + dalke, pitrou
2008-08-09 11:26:56dalkesetmessageid: <1218281216.04.0.602641395217.issue3531@psf.upfronthosting.co.za>
2008-08-09 11:26:49dalkelinkissue3531 messages
2008-08-09 11:26:49dalkecreate