Still having memory problems with CORBA objects in ORBit



here's the functions I'm using to create and delete an object. I'm using
ORBit 0.5.3, on Debian GNU/Linux 2.2

as far as I can see, it does everything that I should be doing -
although I expect there's still something I'm missing, as it's not
working.

the problem is that repeatedly calling factory_GetDataObject() to create
an object and data_delete() to delete it slowly causes the server's
memory usage to increase, leading me to believe I'm not freeing all
resources correctly.

does anyone have an example of using a factory to create and delete
objects?

(this was generated automatically)

static data
impl_data__create(PortableServer_POA poa, CORBA_Environment * ev)
   {
   data retval;
   impl_POA_data *newservant;
   PortableServer_ObjectId *objid;

   newservant = g_new0( impl_POA_data , 1 );
   newservant->servant.vepv = &impl_data_vepv;
   newservant->poa = poa;
   POA_data__init((PortableServer_Servant) newservant, ev);
   objid = PortableServer_POA_activate_object(poa, newservant, ev);
   CORBA_free(objid);
   retval = PortableServer_POA_servant_to_reference(poa, newservant,
ev);

   return retval;
   }

(This is almost identical to the one generated by orbit-idl
--skeleton-impl, but it seems to do everything I've been told it should.
It's just a regular method, that's supposed to free up the object's
resources)

static void
impl_data_delete(impl_POA_data * servant, CORBA_Environment * ev)
   {
   PortableServer_ObjectId *objid;

   printf( "deleting an object\n" );

   objid = PortableServer_POA_servant_to_id(servant->poa, servant, ev);
   if (ev->_major != CORBA_NO_EXCEPTION)
      fprintf(stderr, "exception: %s\n", CORBA_exception_id(ev));

   PortableServer_POA_deactivate_object(servant->poa, objid, ev);
   if (ev->_major != CORBA_NO_EXCEPTION)
      fprintf(stderr, "exception: %s\n", CORBA_exception_id(ev));

   CORBA_free(objid);

   POA_data__fini(servant, ev);
   if (ev->_major != CORBA_NO_EXCEPTION)
      fprintf(stderr, "exception: %s\n", CORBA_exception_id(ev));

   free(servant);
   }


(This is the function that actually creates a new object)

static data
impl_factory_getDataObject(impl_POA_factory * servant, CORBA_Environment
* ev)
   {
   data retval = impl_data__create(servant->poa,ev);

   return retval;
   }







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]