[omniORB] Nil Object References memory?

Martin Trappel 0xCDCDCDCD at gmx.at
Mon Jul 14 09:10:42 BST 2008


Martin Trappel wrote:
> Hi!
> 
> In omniORB docs chapter 12.1 (dynamic loading and unloading): "... which 
> is that normally nil object references are heap allocated, and only 
> deallocated when the ORB is destroyed. ..."
> 
> Does that mean that a long running program that never shuts down the orb 
> will 'leak' memory? Or is there just one nil object for each interface 
> or something alike?
> 

OK. I should have checked the sources beforehand. One nil object 
reference per interface:
-----------------------
Echo_ptr
Echo::_nil()
{
#ifdef OMNI_UNLOADABLE_STUBS
   static _objref_Echo _the_nil_obj;
   return &_the_nil_obj;
#else
   static _objref_Echo* _the_nil_ptr = 0;
   if( !_the_nil_ptr ) {
     omni::nilRefLock().lock();
     if( !_the_nil_ptr ) {
       _the_nil_ptr = new _objref_Echo;
       registerNilCorbaObject(_the_nil_ptr);
     }
     omni::nilRefLock().unlock();
   }
   return _the_nil_ptr;
#endif
}
------------------------

Sorry for the noise :-)

cheer,
Martin



More information about the omniORB-list mailing list