[omniORB] memory leaking, about LocalObject's _var type

Duncan Grisby duncan at grisby.org
Mon Aug 21 15:49:27 BST 2006


On Monday 21 August, "Wernke zur Borg" wrote:

> >   I'm using OMNIORB_4_1_0_BETA_2
> >   I build instance( of local interface ) repeatedly and 
> > assign it to same 
> > _var type variable. It seems that the memory allocated last 
> > time was not 
> > released.
> 
> You should derive your servants from RefCountServantBase and use
> _remove_ref() to dispose of the servant. Note that the constructor
> already increments the ref count, therefore you have to explicitly call
> _remove_ref() when you are done with the object. It is not enough to use
> the servant_var assignment operator. It seems strange anyway to use an
> object reference variable to hold an instance of a servant. Normally you
> would use a servant pointer for it I believe.

He's talking about local interfaces, not normal interfaces. There is no
servant class in that case, just the interface implementation. Local
interface support is a new feature in omniORB 4.1.

As an aside, omniORB 4.1 also deprecates RefCountServantBase as required
by the 1.1 version of the C++ mapping. Now the reference counting
behaviour is in the base ServantBase class.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list