[Python-bugs-list] [ python-Bugs-828737 ] unicode translate leaks memory

SourceForge.net noreply at sourceforge.net
Thu Oct 23 04:03:08 EDT 2003


Bugs item #828737, was opened at 2003-10-23 10:03
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=828737&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Fredrik Lundh (effbot)
Assigned to: Nobody/Anonymous (nobody)
Summary: unicode translate leaks memory

Initial Comment:
(Python 2.3.2, running on Windows 2K)

this program needs over 100 megabytes (and lots of CPU 
time) for n=10, and runs out of memory for n=100.

charmap = {
    ord("&"): u"&",
    ord("<"): u"&lt;",
    ord(">"): u"&gt;",
    ord('"'): u"&quot;",
}

for n in (1, 10, 100, 1000):
    text = u'abc<def>ghi'*n
    print n, len(text)
    print text.translate(charmap)

</F>


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=828737&group_id=5470



More information about the Python-bugs-list mailing list