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

Arthur Peters amp at singingwizard.org
Fri Nov 19 00:17:50 CET 2004


Hello,

Straight to the question:

Is there a way to have Booth.Python or python keep a pointer to the C++
object in memory (as a pointer, not a string or other representation)
while the Python object wrapping it exists?

This may be a silly question. I don't know the internals of Boost.Python
or python well.

This is important because I am writting a program that uses libgc (the
boehm garbage collector) so pointers do not have owners in the standard
sense. The garbage collector will clean things up when noone references
them anymore. If a reference to the object exists in python land there
must be a plain pointer in memory somewhere or the object will be
deleted by libgc. And I don't python to delete it because C++ might
still have references.

Thanks a bunch

-Arthur



More information about the Cplusplus-sig mailing list