[omniORB] Memory leak related to Proxy Object Factories
Duncan Grisby
duncan at grisby.org
Mon Dec 11 18:31:25 GMT 2006
On Tuesday 5 December, Tuyen Chau wrote:
> I need some help tracking down what appears to be a memory leak deep
> in the proxy object factories (POF), or how they interact with other
> components in omniORB. In our application, we derive from the default
> POFs to instantiate our own proxies. This all works fine. However,
> when we take another step in our proxy object factories and try to
> cache our proxies so that there is a unique object reference for each
> servant, we ran into a memory leak of about 600-700 bytes, each time
> our POF is called. Here's how we cache the object. We use the key in
> the omniIdentity to identify object. If an object has been created
> for that key, we increment the reference count on the object and
> return it. If not, we create a new object and cache it. Our
> newObjRef(() function looks approximately like this,
>
> OurPofClass::newObjRef(omniIOR* ior, omniIdentity* ident) {
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.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the omniORB-list
mailing list