[omniORB] How to destroy objects

Brian Neal bgneal at gmail.com
Tue Jul 2 20:22:06 BST 2013


On Tue, Jul 2, 2013 at 8:18 AM, Stefan Walter <Stefan.Walter at lisec.com> wrote:
> how do I destroy objects in omniORB which are not longer required.
>
> If you look at the code below (from the echo example), the only destroy
> happens on the "orb" and not on the "obj" at the end.

If you want to explicitly tear down the CORBA environment you can call
orb->destroy(). This would normally happen upon program exit anyway.

> What if I don't need the "obj" anymore? How can I destroy it?

In the example code:

CORBA::Object_var obj = getObjectReference(orb);

The Object_var will automatically call CORBA::release() on the object
reference when its destructor runs. You'll see a lot of these _var
types in the IDL to C++ mapping, and they all perform cleanup actions
like this.

For more information see the IDL to C++ mapping document, and / or the
Advanced CORBA Programming with C++ book by Henning & Vinoski.

-BN



More information about the omniORB-list mailing list