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

=?gb2312?B?zrTWqiDUqsvY?= wzhys6 at hotmail.com
Sat Aug 19 13:19:49 BST 2006


Hi:
  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.
  Following is the test:
// test.idl
#include <orb.idl>

local interface testinterface
{
};

//test_i.cc
// g++ -I. -I /usr/local/include/omniORB4 -L /usr/local/lib -lomniORB4 *.cc
//
// Example code for implementing IDL interfaces in file test.idl
//

#include <iostream>
#include <test.hh>

class testinterface_i: public testinterface {
public:
  // standard constructor
  testinterface_i();
  virtual ~testinterface_i();

};

testinterface_i::testinterface_i(){
  // add extra constructor code here
}
testinterface_i::~testinterface_i(){
  std::cerr << std::endl<<"~testinterface_i()"<<std::endl;
}

int main(int argc, char** argv)
{
  try {
    // Initialise the ORB.
    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
    // test.Built instance repeatedly and assign it to t.
    testinterface_var t;
    for( int i=0; i< 30000000; i++)
    {
        // It seems that the memory allocated last time was not released.
        t = new testinterface_i();
    }
    orb->destroy();
  }
  catch(...)
  {
    std::cerr << "An error was catched."<<std::endl;
  }
  return 0;
}

_________________________________________________________________
Ãâ·ÑÏÂÔØ MSN Explorer:   http://explorer.msn.com/lccn  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.idl
Type: text/x-idl
Size: 58 bytes
Desc: not available
Url : http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20060819/c27ba6db/test.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_i.cc
Type: text/x-c++src
Size: 980 bytes
Desc: not available
Url : http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20060819/c27ba6db/test_i.bin


More information about the omniORB-list mailing list