Memory management questions



Hi,

I'm still working on writing ORBit bindings for Objective Caml. It's
mostly done now and works quite well (client and server). Many thanks
to James Henstridge for helping me with the server part !

I have some issues about memory management though. When calling
CORBA_ORB_destroy (either directly or at program exit) ORBit will
bitch about leaking refs and raise an exception if all object
references have not been released. Now, Objective Caml uses a garbage
collector and finalization of values is non-deterministic. Garbage
collected object references are released via CORBA_Object_release but
when the program exits, recently allocated object references are still
around. And then CORBA_ORB_destroy fails.

So I had to track all objects on the Caml side, using a hash table and
some reference counting. Now I can release 'leftover' objects at
program termination, but :

  - it's a bit silly since the orb already has this information and
    could release the objects by himself it seems ;

  - it breaks sometimes : for instance, POA_destroy releases some
    objects/servants it controls and when caml tries to release them
    again, it crashes (I'm not too sure this is what's happening, just
    a guess).

So, why does CORBA_ORB_destroy fail when there are still object
references ? Is it simply to force programmers to properly release all
their objects before exit or is there some other reason ?

-- 
   Olivier



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]