[omniORB] Memory leak in cdrEncapsulationStream (cdrMemoryStream)

Duncan Grisby duncan at grisby.org
Fri Oct 22 23:27:18 BST 2004


On Friday 22 October, Harri Pasanen wrote:

> I'm strongly suspecting a memory leak in cdEncapsulationStream.
> ( cdrMemoryStream.cc,v   Revision 1.1.4.10  2003/02/17 01:24:04  
> dgrisby)
> 
> Because in cdrEncapsulationStream::getOctetStream it sets the 
> pd_readonly_and_external_buffer = 1, the cdrMemoryStream destructor 
> never releases pd_bufp.

There is no leak there. The stream passes ownership of its buffer to
the IOP profiles sequence, which deallocates it when the object
reference is destroyed.

The fact that you're seeing a leak means that you have leaked an
object reference somewhere, or that there's a leak bug in omniORB
somewhere else.

Having looked at the code in cdrEncapsulationStream, I have actually
found a theoretical bug where getOctetStream could return a pointer to
data on the stack, which would be deleted later. As far as I can see,
other conditions mean that that never actually occurs (and it would
segfault immediately if it did), so it's not really a problem. I've
fixed that in CVS, but it's unrelated to the leak you're seeing.

Cheers,

Duncan.

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



More information about the omniORB-list mailing list