Re: [Orbit-python-list] Committed my fixes to CVS
Status: Inactive
Brought to you by:
tack
From: Jason T. <ta...@li...> - 2000-08-18 14:01:01
|
> night that was, with only half as much progress as I would have liked. > Anyway I committed my changes up to 2000-08-18 08:18 UTC+2, so you can > pull it from CVS. Good stuff. :) > leaks have been fixed". Darn me, I spent a huge part of the night > trying to see why CORBA_PyObject__dealloc wouldn't free the memory > allocated for an object reference by a call to > poa.servant_to_reference(), before I realised that this function > wasn't called. For some reason, the reference object thusly allocated > is never freed, or its destructor is never called, or its refcount is I haven't been able to reproduce this behaviour. At least, with this code: servant = POA.Fruit.Factory(Factory()) poa.activate_object(servant) ref = poa.servant_to_reference(servant) CORBA_PyObject__dealloc is being called. However, in investigating this, I did run into a problem that servants were not being freed, not because of servant_to_reference(), but because of activate_object(). So it seems to me that the supposed servant_to_reference() problem was a bit of a red herring (although there still could be a problem there). The problem in activate_object() was that I was setting the servant object as an attribute of the implementation instance (_servant) which INCREFed the servant object, and since the destructor for the impl class wasn't freeing it, it was left in limbo. Of course, the _servant attribute was just a hack until I could figure out how things are supposed to work, but it just got left in there. I updated the code: // create a _servant attribute in the implementation instance. // This really is a hack and will likely eventually go away. This // attribute is a borrowed reference. Py_DECREF(servant); PyObject_SetAttrString(servant->servant->impl, "_servant", (PyObject *)servant); Servants are now correctly being freed. The ref object returned by poa.servant_to_reference() is being freed properly (at least, CORBA_ PyObject__dealloc is invoked), so I can't reproduce what you described above. If the problem persists, can you send me a snippet of code to repreoduce it? Incidentally, I added you to the AUTHORS file and updated the ChangeLog. Don't forget to update ChangeLog when you make commits. Thanks, Jason. |