[issue27831] Python 3.4.5 leaks memory when attempting to load non-existent file

geeknik report at bugs.python.org
Tue Aug 23 14:14:08 EDT 2016


geeknik added the comment:

Sure, 3.5 and/or 3.6 has memory leaks during compilation:
https://bugs.python.org/issue27780

And I just compiled 3.5.2 and running that version of python against a non-existent file returns this from LeakSanitizer:

ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-3.5/bin/llvm-symbolizer ASAN_OPTIONS=symbolizer=1 ./python garbage
./python: can't open file 'garbage': [Errno 2] No such file or directory

=================================================================
==5338==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 657546 byte(s) in 584 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12

Direct leak of 43896 byte(s) in 63 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4de339 in PyMem_RawMalloc /root/python-3.5.2/Objects/obmalloc.c:293:12
    #2 0x4de339 in _PyObject_Alloc /root/python-3.5.2/Objects/obmalloc.c:1376

Direct leak of 42520 byte(s) in 31 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12
    #2 0x7e39df in _PyEval_EvalCodeWithName /root/python-3.5.2/Python/ceval.c:4018:14

Direct leak of 28160 byte(s) in 7 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12
    #2 0x6535ab in set_add_entry /root/python-3.5.2/Objects/setobject.c:313:12

Direct leak of 3584 byte(s) in 15 object(s) allocated from:
    #0 0x4bd79e in realloc (/root/python-3.5.2/python+0x4bd79e)
    #1 0x4db6aa in PyMem_Realloc /root/python-3.5.2/Objects/obmalloc.c:343:12

Direct leak of 3584 byte(s) in 16 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12
    #2 0x682a09 in type_call /root/python-3.5.2/Objects/typeobject.c:890:11

Direct leak of 448 byte(s) in 2 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12
    #2 0x88e289 in _Py_InitializeEx_Private /root/python-3.5.2/Python/pylifecycle.c:377:14
    #3 0x4e553f in Py_Main /root/python-3.5.2/Modules/main.c:669:5
    #4 0x4dae5e in main /root/python-3.5.2/./Programs/python.c:65:11

Direct leak of 264 byte(s) in 2 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12
    #2 0x4e553f in Py_Main /root/python-3.5.2/Modules/main.c:669:5
    #3 0x4dae5e in main /root/python-3.5.2/./Programs/python.c:65:11

Direct leak of 96 byte(s) in 3 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db387 in PyMem_RawMalloc /root/python-3.5.2/Objects/obmalloc.c:293:12

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12
    #2 0x4e5942 in Py_Main /root/python-3.5.2/Modules/main.c:693:5
    #3 0x4dae5e in main /root/python-3.5.2/./Programs/python.c:65:11

Indirect leak of 124748 byte(s) in 133 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4de339 in PyMem_RawMalloc /root/python-3.5.2/Objects/obmalloc.c:293:12
    #2 0x4de339 in _PyObject_Alloc /root/python-3.5.2/Objects/obmalloc.c:1376

Indirect leak of 6016 byte(s) in 47 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12
    #2 0x682a09 in type_call /root/python-3.5.2/Objects/typeobject.c:890:11

Indirect leak of 2912 byte(s) in 7 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12

Indirect leak of 640 byte(s) in 5 object(s) allocated from:
    #0 0x4bd4ab in malloc (/root/python-3.5.2/python+0x4bd4ab)
    #1 0x4db577 in PyMem_Malloc /root/python-3.5.2/Objects/obmalloc.c:325:12
    #2 0x68dea1 in tp_new_wrapper /root/python-3.5.2/Objects/typeobject.c:5595:11

SUMMARY: AddressSanitizer: 914422 byte(s) leaked in 916 allocation(s).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27831>
_______________________________________


More information about the Python-bugs-list mailing list