[Python-bugs-list] [ python-Bugs-456504 ] Memory leak in PyString_FromString

noreply@sourceforge.net noreply@sourceforge.net
Wed, 29 Aug 2001 12:40:33 -0700


Bugs item #456504, was opened at 2001-08-29 06:09
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=456504&group_id=5470

>Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Barry Warsaw (bwarsaw)
Summary: Memory leak in PyString_FromString

Initial Comment:
Purify (on WinNT) reports a memory leak:

Memory leak of 567 bytes from 14 blocks allocated in 
PyString_FromString
    Distribution of leaked blocks
    Allocation location
        malloc       [msvcrt.dll]
        PyString_FromString [python21.dll]
        ???          [python.exe ip=0x00405059]

This fragments the heap and my long-running program 
eventually runs out of memory. I was running my sample 
program with wxPython and so could not run debug 
version for more explicit info without compiling wx 
myself. If this is not enough info we can probably get 
a more detailed output.

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

>Comment By: Tim Peters (tim_one)
Date: 2001-08-29 12:40

Message:
Logged In: YES 
user_id=31435

I'm afraid we need better evidence of a "real leak" than 
this.  PyString_FromString is called from 100s of 
locations, and some of the targets are file-static vrbls 
that indeed are never *expected* to get cleared (for 
example, abstract.c constructs the string "__bases__" once 
and then reuses it forever after).

BTW, it's extremely unlikely that a "loss" of 567 bytes is 
causing you to run out of memory, yes?  I'd look elsewhere.

Assigning to Barry, since he runs Insure++ regularly.

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

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