Search code examples
c++memory-leakssequencecorba

CORBA sequence memory leak


I am having a problem with a sequence of sequences in CORBA. I could resolve the problem with a non elegant solution (at least for me is not elegant).

The (not real) code that generate memory leak is like:

{
   IntMatrix m;
   m.lenght(100);
   for (int i = 0; i < 100; i++)
   {
      m[i].lenght(99);
   }
   //Send 'm' matrix and exit from this scope
}

The (non elegant) solution is like:

{
  IntMatrix m;
  m.lenght(100);
  intSeq s;
  s.lenght(99);
  for (int i = 0; i < 100; i++)
  {
      m[i] = s;
  }
  //Send 'm' matrix and exit from this scope
}

I had been looking for a cause in Internet and I could only found text about a flag named "release".

Can somebody help me?

Thanks.


Solution

  • I'm assuming that when you say 'Send m matrix' you are on the client side.

    I think the first piece of code is correct. If you have a memory leak, it could due to a bug in the ORB implementation your are using.