0

I am studying CORBA and how IDL maps interfaces to different languages. I read that you can not write constructors and destructors in an IDL interface because objects are not created locally.

My question is:

How can a client delete an object if he does not specify a destructor in the IDL interface, is the server only responsible for deleting objects? Does CORBA provide a garbage collection mechanism/specification or is the language on the server side responsible to do that? If only server is responsible to delete objects how can it be sure that an object should be deleted? Pinging the client?

Avraam Mavridis
  • 8,698
  • 19
  • 79
  • 133

1 Answers1

0

An e-mail replay from one of my professors:

  • All lifecycle management of CORBA objects is done by the object adapter. There is no built-in garbage collection in CORBA (except that non-persistent objects are deactivated and removed automatically when the session expires or hangs, or when a time limit has expired). The servant object deregistration method deactivate_object() should be explicitly called on the OA (in server code) to make the OA deregister/deallocate an object properly (after awaiting that all possibly still running calls on that object have terminated).

  • For simulating remote constructor behavior, a (server-side) factory object (another CORBA object) should be used.

  • For simulating remote destructor behavior, the factory object might provide an explicit destroy method (user-level memory management controlled by client) or implement reference counting for garbage collection at user level (controlled by the server). The latter is tricky because the ordering with the servant deregistration call to the OA (deactivate_object()) must be correct.

Avraam Mavridis
  • 8,698
  • 19
  • 79
  • 133
  • Your professor is generally correct, but this part is not: "non-persistent objects are deactivated and removed automatically when the session expires or hangs, or when a time limit has expired". CORBA has no notion of sessions, so this is not accurate. Some ORBs did offer session-like semantics on top of the CORBA standard but it was always through vendor-specific, non-portable extensions. – Brian Kelly May 29 '13 at 04:14
  • @BrianKelly So there is nothing about garbage collection in CORBA specification? It's up to the vendor to implement it or not? – Avraam Mavridis May 29 '13 at 04:42
  • 1
    There's certainly nothing about client- or session-driven garbage collection, that's right. Here's an example of one of the vendor extensions that adds support for it: http://documentation.progress.com/output/Iona/orbix2000/2.0/session_cpp/html/ – Brian Kelly May 29 '13 at 14:23