Re: [orbitcpp-list] Destroying CORBA objects
Status: Beta
Brought to you by:
philipd
From: Phil D. <ph...@us...> - 2000-10-19 10:16:05
|
Hi Sam, You're right - a 'delete this' (on its own) will cause problems since the object must be removed from the active object map before deleting otherwise the poa will continue sending requests to a dead servant. Michi Henning (Advanced CORBA Programming with C++) recommends that the 'free' call (called 'remove' in the CORBA lifecycle spec - you may want to copy this convention) be put on the object interface rather than the factory, since object refs can be passed between servers and so having to keep track of the parent/factory can be a pain. Note that both COM and EJB follow this approach (in methods 'IUnknown::release()' and 'EJBObject.remove()' respectively). <The bad news> Unfortunately orbitcpp doesn't have the poa infrastructure to do this right now, but I am currently working on it. Expect the code to be in cvs within the next 2 weeks. I'll keep you posted. </The bad news> Cheers, Phil Sam Couter writes: > All, > > I have a CORBA application that creates many objects on the server side, > continuously. I need a way to destroy these objects to avoid memory leaks. > > The application was previously using ORBit, and all I did was provide a > free() method on each object, which the client called when it was finished > with the object. > > Now that I need to tie the application into a C++ API, I've decided to use > ORBitcpp. > > So, how do I destroy an object in the server in ORBitcpp? I know how to > create one (the Account/Bank example), but doing "delete(this)" to destroy > it seems like suicide to me. > > Should I provide a bunch of freeObjectFoo() methods on the factory object > that's creating them all in the first place? This doesn't seem like the > correct solution. If I do this, what do I need to do to destroy the objects > passed to this method? > > Thanks. > -- > Sam Couter | Internet Engineer | http://www.topic.com.au/ > sa...@to... | tSA Consulting | > PGP key available on key servers > PGP key fingerprint: A46B 9BB5 3148 7BEA 1F05 5BD5 8530 03AE DE89 C75C |