[omniORB] the _dispose() function of the objects

Pletyak Attila attila.pletyak@anemosky.com
Fri, 09 Feb 2001 16:26:51 +0100


Hello I have a question, please answer if you can.

I made a project with omniORB 2.8 on Debian Linux 2.2. 

In this the CORBA objects are created and got rid of after a time of
inactivity. I am focusing on the disposal of objects.

In this project there is a CORBA interface the purpose of which is to
create objects on requests. (the created objects also have a CORBA
interface.)

It looks like this:

interface A 
{
	Object createAnObject(in string name, in string parameters);
};

and in the implementation we have:

#include "BImpl.hh"  // B.hh was generated by omniidl2 for B.idl

CORBA::Object* A_impl::createAnObject(const char* name, const char*
parameters)
{
	if (!strcmp(name, "B")
		{
			BImpl* myB = new BImpl(parameters);
			return B::_duplicate(myB);			
		}

  return CORBA::Object::_nil();
};

When I started the object-creation CORBA program I saw in 'top' that the
size of it was 8000. After I made it to create 1000 object, the size of
it grew to 20000, it was okay, 12K/created object. After these the
following method was called in the created objects from outside (a third
program):

void BImpl::destroy()
{
  time_t tNow = time(NULL); 
#if DEBUG==1
  log << "===== " << ctime(&tNow) << ": destroy() called. =====" <<
endl;
  log.close();
#endif
  Cache.clear(); // the local Cache of the object, it is an STL <list>.
  this->_dispose();
}

This is fine, as the ~BImpl() is also called after this. But the size of
the creator program remains the same. I did not understand it. Maybe at
creation I should use B_var myB = new BImpl(paramters); as the B_var
takes care of duplications, etc. ?

The MyClassImpl class does not contain any dynamic fields, it contains
STL templates, longs, etc.

After this I created 1000 other objects, and they did not use as much
memory, only 2k/object. I created yet an other 1000 objects, and their
size-increase was 12k/object again. And now I re-created the original
1000 objects, and they needed only 9k/object. 

So basically this is the situation. I should find a solution to it. I
don't know if I am messing up something (I am sure of it in 99%) or this
is an omniORB feature I don't noticed yet.

Any answer is appreciated.

Attila Pletyak