[omniORB] Memory leak related to Proxy Object Factories

Tuyen Chau tchau at verano.com
Thu Dec 14 12:28:47 GMT 2006


Duncan Grisby wrote:
> The things that are leaking are the ior and identity. The new object
> reference takes ownership of them, so if you return an existing object
> reference, they are never released. It's easy for you to release the
> ior, but the identity is more tricky since it is assigned to the objref
> in createObjRef() in omniInternal.cc. You'll have to tweak that to look
> to see if the objref already has a different identity and release the
> new one if it does.
>
> Cheers,
>
> Duncan.
>   
Thanks for your response, Duncan.

I've looked into the omniOrb code as you suggested and it is not as 
straight forward as it sounds, so instead, I looked for work arounds.  
The work-around that we came up and are happy with, is to create a dummy 
objref to take ownership of the ior and identity, and set a timer for 1 
second with the dummy objref passed into the timer handler as a 
parameter.  When the timer expires, the timer handler gets called, and 
releases the dummy objref.

In this work around, we assume 1 second is long enough to execute the 
omniOrb code between the newObjRef() call and before calling our code.  
We also assume that returning a cache objref, instead of a new one, does 
not confuse omniOrb in any other way other than the memory leak problem.

We've tested our work-around and got mixed results.  In a simple test, 
the leak is gone.  In a much more complicated test that is supposed to 
run for days, we got a C++ Runtime exception (no pure virtual function 
call) that seemed to happen on a random basis.  We are not sure if the 
exception that we got is a different problem altogether or related to 
the work-around that we took.  Does this work-around look OK to you, or 
are we missing the boat here?

Thanks so much in advance for any assistance that you can provide,
Tuyen





More information about the omniORB-list mailing list