[C++-sig] Boost.Python and garbage collection

john haddon theboyhaddon at hotmail.com
Sun Nov 4 22:33:11 CET 2007


>># delete the instances and run the garbage collector
>>del o1
>>del o2
>>gc.collect()
>
>Maybe this doesn't invalidate your conclusions, but just a heads up: don't simply call " gc.collect()", instead do>"while gc.collect(): pass".  That is because sometimes multiple GC iterations are required to collect all objects.

Thanks for the tip. I've rerun the tests with your adjusted code and fortunately my mistake doesn't invalidate the original conclusion - which makes sense as without the additional code there's no way for the garbage collector to see the contents of the dict for the instance...
_________________________________________________________________
Send a smile, make someone laugh, have some fun! Start now!
http://www.freemessengeremoticons.ca/?icid=EMENCA122


More information about the Cplusplus-sig mailing list