[omniORB] Confusion over different 'release' functions for a pointer....

Ben Miller Ben.Miller@Mercia.Com
Thu, 6 Jul 2000 10:51:32 +0100


Hi all, I'm having some problems getting my head around how I should
free-up my CORBA objects.

In my client program, if I have a pointer to an interface (created by
the server) like this...

mlcs::DLM_ptr dlm_obj_ptr = svr_obj_ref->createDLMInterface();

...I am confused as to the differences between...

1.  CORBA::release(obj_ptr);
2.  obj_ptr->_remove_ref();

Which is the correct way to free up my pointer?

If I used the smart-style pointer, like this...

mlcs::DLM_var dlm_obj_ptr = svr_obj_ref->createDLMInterface();

...what would the destructor call to release the underlying object?

Also, am I right in thinking that I should never explicitly 'delete' a
server object implementation, even if I called 'new' on it?

Regards,
Ben



Mercia Software Ltd.
Mercia House 
Ashted Lock
Aston Science Park
Birmingham B7 4AZ, UK 
Registered Number: 1868855 (Cardiff) 
Tel: 44 (0)121 359 5096 
Fax: 44 (0)121 359 0375 
Web Site: http://www.mercia.com