[omniORB] Possible memory leaks?

Jared Peterson jared@tgflinux.com
Fri, 15 Dec 2000 13:33:05 -0800


I am having what seems to be a small memory leak and I think that it may
have to do with me not deactivating objects properly.
I have written a simple test interface and factory that hands out the
objects.  If I run a client that gets an object then destroys the object
the memory footprint on the server still continues to grow.  Here is the
code for the  create method in the factory.

test_ptr testfactory_i::create()
{
    test_i* myTest = new test_i();
    PortableServer::ObjectId_var myTestid =
myPoa->activate_object(myTest);
    CORBA::Object_var obj = myPoa->servant_to_reference(myTest);

    return test::_narrow(obj);
}

and the destroy method in the class is as follows

void test_i::destroy()
{
    PortableServer::ObjectId_var id = myPoa->servant_to_id(this);
    myPoa->deactivate_object(id);
}

Am I doing something wrong?  If I start up the server and then run the
client which just creates and destroys objects in a loop the footprint
slowly grows and grows.  So if anyone out there could offer some advice
that would be great ... thanks.

Jared Peterson