Skip to content

Memory leak in strtree #161

@caspervdw

Description

@caspervdw

Found in #159 - almost all tests in test_strtree show a memory leak. Example valgrind trace:

___________________________ test_init[geometry0-0-0] ___________________________
[VALGRIND LEAK]

Valgrind has detected a memory leak:

**1** 
**1** **********************************************************************
**1** pygeos/test/test_strtree.py::test_init[geometry0-0-0]
**1** **********************************************************************
==1== 1,096 (+1,096) bytes in 1 (+1) blocks are definitely lost in loss record 16,587 of 18,433
==1==    at 0x4C2C21F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1==    by 0xE5F5DFF: GEOS_init_r (in /usr/lib/x86_64-linux-gnu/libgeos_c.so.1.9.1)
==1==    by 0xE3E19F7: STRtree_new (strtree.c:137)
==1==    by 0x4F7DF84: type_call (typeobject.c:895)
==1==    by 0x4F3A18B: _PyObject_FastCallDict (abstract.c:2331)
==1==    by 0x4FB3672: call_function (ceval.c:4875)
==1==    by 0x4FACA4E: _PyEval_EvalFrameDefault (ceval.c:3335)
==1==    by 0x4FB4C49: _PyEval_EvalCodeWithName (ceval.c:4166)
==1==    by 0x4FB4C49: _PyFunction_FastCallDict (ceval.c:5084)
==1==    by 0x4F3A285: _PyObject_FastCallDict (abstract.c:2310)
==1==    by 0x4F3ABBD: _PyObject_Call_Prepend (abstract.c:2373)
==1==    by 0x4F3A5A6: PyObject_Call (abstract.c:2261)
==1==    by 0x4F8014C: slot_tp_init (typeobject.c:6420)
==1== 
==1== LEAK SUMMARY:
==1==    definitely lost: 5,752 (+1,096) bytes in 7 (+1) blocks
==1==    indirectly lost: 41 (+0) bytes in 3 (+0) blocks
==1==      possibly lost: 9,701,081 (+2,709) bytes in 87,778 (+6) blocks
==1==    still reachable: 20,986,940 (+3,290) bytes in 166,925 (+32) blocks
==1==                       of which reachable via heuristic:
==1==                         newarray           : 747 (+0) bytes in 43 (+0) blocks
==1==                         multipleinheritance: 24,320 (+0) bytes in 409 (+0) blocks
==1==         suppressed: 0 (+0) bytes in 0 (+0) blocks
==1== Reachable blocks (those to which a pointer was found) are not shown.
==1== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==1== 
**1** 
**1** **********************************************************************

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions