Dear list,
Apologies if this has been asked before, but I'm struggling to find
anything strictly related..
Background
----------
This library I'm trying to wrap uses its own memory management model,
where almost every class derives from an object with loads of memory
management-related member functions; it also has a couple of friend
classes related to counting and locking. I don't intend to expose any of
these memory-related functions or friend classes to Python, but I was
thinking that performance could be quite badly affected if both Python and
C++ code are performing separate memory management implementations.
Optimal memory usage
--------------------
I would suppose that memory usage on class instances would probably
contain unnecessary bloat too, as I think each exposed class instantiation
would allocate memory for a normal PyObject as well as unexposed C++
member functions.
Right thing to do
-----------------
I initially hoped to use a 'return_internal_reference' CallPolicy on the
class_<..> init calls, but I doubt that is The Right Thing To Do.
Would it be a better design to define a PyTypeObject for this C++ base
class and its friends? If I did, could I still use functions in
boost::python? I don't think PyTypeObject's are supposed to be derived, so
I don't have a clue what extra I'd have to do to make it work with
Boost::Python.
How should one proceed with this? Links to archived emails or
documentation would be great.. If I can conjure up something good enough
for Boost, I'd be happy to contribute, if possible.
Thanks for your time, and kind regards,
Alex
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig