Title: _PyUnicode_Init leaks a little memory once
Type: resource usage Stage: resolved
Components: Interpreter Core Versions: Python 3.1, Python 3.2, Python 3.3
Status: closed Resolution: duplicate
Dependencies: Superseder: Initialization of globals in unicodeobject.c
View: 10156
Assigned To: stutzbach Nosy List: skrah, stutzbach
Priority: normal Keywords: needs review, patch

Created on 2011-03-05 00:10 by stutzbach, last changed 2011-04-11 07:32 by skrah. This issue is now closed.

File name Uploaded Description Edit
unicode-leak.patch stutzbach, 2011-03-05 00:14
Messages (2)
msg130090 - (view) Author: Daniel Stutzbach (stutzbach) (Python committer) Date: 2011-03-05 00:10
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.
msg133503 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2011-04-11 07:32
This should be a duplicate of issue 10156.
Date User Action Args
2011-04-11 07:32:27skrahsetstatus: open -> closed

superseder: Initialization of globals in unicodeobject.c

nosy: + skrah
messages: + msg133503
resolution: duplicate
stage: patch review -> resolved
2011-03-05 00:14:06stutzbachsetkeywords: + patch, needs review
files: + unicode-leak.patch
2011-03-05 00:10:48stutzbachcreate