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.

classification
Title: unicode string does not get freed --> memory leak?
Type: Stage:
Components: Versions: Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: ThurnerRupert, loewis
Priority: normal Keywords:

Created on 2008-04-26 10:07 by ThurnerRupert, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg65837 - (view) Author: (ThurnerRupert) Date: 2008-04-26 10:07
is it possible that str and unicode str are treated differently, i.e.
unicode str does not give memory back? jonas borgström noticed the
following behaviour:

>>> resident_size()
3780
>>> a = ["%i" % i for i in xrange(2**22)]
>>> resident_size()
239580
>>> del a
>>> resident_size()

4128    <-- Most memory returned to the os
>>> a = [u"%i" % i for i in xrange(2**22)]
>>> resident_size()
434532
>>> del a
>>> resident_size()R

401760  <-- Almost nothing returned to the os 


for details see
http://groups.google.com/group/trac-dev/browse_thread/thread/9de74e1d2f62e2ed.
msg65839 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-04-26 10:35
This is a duplicate of issue 2321. There was no memory leak whatsoever,
instead, malloc just failed to return the memory returned to it (through
free(3)) to the operating system. Don't trust resident_size() to detect
memory leaks; that approach is fairly flawed.
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46948
2008-04-26 10:35:09loewissetstatus: open -> closed
resolution: duplicate
messages: + msg65839
nosy: + loewis
2008-04-26 10:07:32ThurnerRupertcreate