[Python-Dev] Small memory leak in unicodeobject.c

Barry A. Warsaw bwarsaw@beopen.com
Tue, 3 Oct 2000 16:35:10 -0400 (EDT)


>>>>> "M" == M  <mal@lemburg.com> writes:

    M> It would be easier to simply move the Py_DECREF() in front of
    M> the cleanup code for the free list. That way, unicode_empty
    M> would be placed on the free list, but then immedialtely cleaned
    M> up by the following code.

I know that's the obvious fix -- and it was the first thing I tried,
but it doesn't work!  (I thought I mentioned that in my original
message).

Verifying after a cvs up still shows unicode_empty leaking (I loop
through the Py_Initialize/Py_Finalize loop 10 times):

-------------------- snip snip --------------------
       240 bytes     10 chunks allocated at unicodeobject.c, 227
                          malloc()
                  _PyUnicode_New()  unicodeobject.c, 227
                 _PyUnicode_Init()  unicodeobject.c, 5217
                   Py_Initialize()  pythonrun.c, 125
                            main()
        30 bytes     10 chunks allocated at unicodeobject.c, 230
                          malloc()
                  _PyUnicode_New()  unicodeobject.c, 230
                 _PyUnicode_Init()  unicodeobject.c, 5217
                   Py_Initialize()  pythonrun.c, 125
                            main()
-------------------- snip snip --------------------

So let me step through the code and figure out what's wrong...

-Barry