[New-bugs-announce] [issue11402] _PyUnicode_Init leaks a little memory once

Daniel Stutzbach report at bugs.python.org
Sat Mar 5 01:10:49 CET 2011

New submission from Daniel Stutzbach <stutzbach at google.com>:

By the time _PyUnicode_Init is called and does the following:

    /* Init the implementation */                                               
    free_list = NULL;                                                           
    numfree = 0;                                                                

free_list is already in use.  _PyUnicode_Init clobbers whatever was stored there, leaking memory.

In Python 2, this was not an issue because no unicode functions were called prior to initialization.  In Python 3, Unicode objects are created when initializing other types.

I found this using valgrind to search for "definitely lost" memory.  I'd like to fix all of those cases, to make it easier to run valgrind on a regular basis.

I'll upload a patch momentarily.

assignee: stutzbach
components: Interpreter Core
messages: 130090
nosy: stutzbach
priority: normal
severity: normal
stage: patch review
status: open
title: _PyUnicode_Init leaks a little memory once
type: resource usage
versions: Python 3.1, Python 3.2, Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list