[C++-sig] Memory leak when using return_internal_reference !?

gideon may gideon at computer.org
Wed Jun 4 20:07:10 CEST 2003

Hi Dave,

I'm experiencing a memory leak when using the return_internal_reference 

It's probably best explained using the the test_pointer_adoption_ext module 
and a
little test program :

----------- leak.py -----------------

from test_pointer_adoption_ext import *

a = create("leak")
while 1:
    innards = a.get_inner()
    innards = None
    print ".",

When running this program, there is a serious memory leak. When I take out
the line 'innards = a.get_inner()' everything is OK.
I tried to hunt it down and it seems that life_support system created
in life_support.cpp is never deleted, i.e. life_support_dealloc is never 

Do you have any idea what could be the problem ?

I'm using return_internal_reference quite extensively and couldn't live
without it :-)



More information about the Cplusplus-sig mailing list