#1073 [python] Memory leak using directors and vtable

python (259)

An instance of a derived director class in python will not be deleted when such an instance goes out of scope, when using vtable. This is because the method object returned by PyObject_GetAttr (in swig_get_method() in the generated wrapper code) and which is stored in the vtable holds a reference to the actual instance. When many such objects are instantiated and supposedly destroyed, it creates quite huge memory leaks.

Please consider the following minimal example that reproduce the leak
(Need to be run on linux/unix system to be able to print memory usage...)

make withoutleak
python runleaktest.py

make withleak
python runleaktest.py



  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2010-02-16

    A minimal example reproducing the bug

  • William Fulton

    William Fulton - 2010-02-27

    Removed -dirvtable from the list of optimizations options included by -O as a workaround for now.

  • Olly Betts

    Olly Betts - 2011-02-19
    • summary: Memory leak using directors and vtable --> [python] Memory leak using directors and vtable

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks