Re: Newbie questions + bug report...



Frank Rehberger wrote:
> Justin Schoeman wrote:
> 
>> Hi all, I am a newbie to CORBA and ORBit, so please excuse any 
>> irrelevant ramblings...
>>
> 
>> runs in its own thread, and all is well, however, I have no idea how 
>> to create a destructor for the server side object.  If I call:
>> impl_Echo_Echo__destroy(servant, ev);
>> in the destructor, the objects memory is freed, but it remains 
>> registered with the POA, so shutting down the main ORB results in a 
>> segfault when the POA tries to release the object.  If I call:
>> PortableServer_POA_deactivate_object(servant->poa, objid, ev);
>> in the destructor, everything seems to work fine (even the __destroy 
>> method is called by the POA), _but_ the system leaks memory.
>>
>> What is the correct way to destroy a server side object?
> 
> 
> Shame on me, it is a bug in orbit-documentation. You need to call
> 
> PortableServer_ObjectId* oid =  PortableServer_POA_servant_to_id(poa, 
> servant, ev);
> PortableServer_POA_deactivate_object  (poa, oid, ev);
> 
> this will deregister your object from POA, and will invoke objects 
> associated finalizer __fini.
> If servant is calling "deactivate_object" in scope of method call, 
> invocation of finalizer is delayed.
> 
> Currently I am fixing this chapter in orbit documentation.

Yes, I have tried this.  It leaks memory. Probably due to the delayed 
finalizer.  When is the finalizer executed - Is it possible to force 
execution to validate memory usage?

>> Also, how do you shut down the ORB cleanly in a multi-threaded 
>> environment?  I use the signal handlers as in the examples, but this 
>> gives an error that shudwon must be called from the main thread... Hiw 
>> do I get around this?
>>
> please attach error message.

Sorry - that was a simple one to do - I just added:

if(giop_thread_self() != giop_thread_get_main()) return;

In my signal handler, to make sure that CORBA_ORB_shutdown is only 
called from the main thread.

Thanks for the help.

-justin




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