Hi Wim,
<wlavrijsen_at_lbl.gov> writes:
> A couple. If, as I understand your message, all these particular C++ objects
> that you have participate in the C++-side reference counting and should never
> be managed by python, then do:
>
> from GaudiPython import gbl
> gbl.DayaBay.__init__._creates = False
> ud = gbl.DayaBay.UserDataHeader()
The "DayaBay.__init__" doesn't apparently have a "_creates" member:
In [1]: from GaudiPython import gbl
In [2]: gbl.DayaBay.__init__._creates
AttributeError Traceback (most recent call last)
/home/bviren/work/dayabay/offline/NuWa-trunk/dybgaudi/RootIO/RootIOTest/cmt/<ipython console> in <module>()
AttributeError: 'wrapper_descriptor' object has no attribute '_creates'
I couldn't find this "wrapper_descriptor".
However, I find that the class object does have this member. See the following ipython session. However, the underlying C++ object can not be kept alive after the Python object is del'ed:
Out[4]: 0 In [5]: gbl.DayaBay.UserDataHeader.__init__._creates = False In [6]: udh = gbl.DayaBay.UserDataHeader() In [7]: del(udh) Destroying UserDataHeader (0x93d7df8) #0 @Thu, 01 Jan 1970 00:00:00 +0000 (GMT) + 0 nsec In [8]: udh = gbl.DayaBay.UserDataHeader() In [9]: udh.addRef()
FYI, that "Destroying..." message is instrumented in the ~UserDataHeader() destructor and dumps the C++ pointer (followed by an event number and event time stamp, both zero in this test).
> Additional options are to tell the function that stores the object into the
> store that it should take ownership rights, or setting ownership on the
> python object directly.
I can explore this. Do you have some pointers?
> Note that GaudiPython has a different memory policy by default then
> does ROOT.
Okay. Is this something I need to understand to solve this problem?
Thanks!
-Brett.
This archive was generated by hypermail 2.2.0 : Fri Feb 25 2011 - 23:50:01 CET