Re: bonobo-activation; freeing base services ...



On 27Oct2001 04:08AM (-0400), Michael Meeks wrote:
> 
> 
> On Fri, 26 Oct 2001, Maciej Stachowiak wrote:
> > > On the library level, it'd be pretty insane if you
> > > had to call a shutdown function for every lib though.
> >
> > The logical conclusion is that libraries must avoid needing any kind
> > of shutdown processing for correct operation.
> 
> 	Well - why not do - as I plan to do inside libbonobo, allow
> the user to explicitely shutdown the library, allow double shutdowns
> to succeed transparently, and register a g_atexit for the shutdown
> when you init.
>
> 	This way, the user can explicitely enforce a certain shutdown
> order, regardless of system / portability etc. but normal people get
> their resources freed too. Furthermore if g_atexit is found to be a
> big pain on some systems, we have some flexibility to do it ourselves.
> 

I think that approach does not really solve the most serious problems
with atexit handlers that Havoc raised, namely the need to use _exit
instead of exit in a fork/exec pair, and the possibility of
overflowing the system maximum limit of atexit handlers.
 
> > I don't really know either. Michael, are your changes avoid leaking
> > remote resources or to free memory?
> 
> 	They avoid a warning saying:
> 
> ** WARNING **: ORB: a total of 2 refs to 2 ORB objects were leaked
> 
> 	These being the base services, oh - and it calls the ORB
> destroy so the ORB is cleaned up correctly, and it moves the code that
> currently does this from bonobo - to where the resources are allocated
> in bonobo-activation.

Does this warning indicate anything actually harmful? Will system
resources be leaked? If not, perhaps it would be better to have a way
to mark an object as `immortal' (i.e. not expected to be freed by
program termination). After all, a fixed small number of objects
allocated at program startup and never freed do not really constitute
a leak.

Another possibility is that if the warnings are purely advisory but do
not come up on abnormal program termination, it does not seem so bad
to install an atexit handler which would be called only on normal
termination to avoid them. (Havoc, what would you think of that?)


> 
> 	Anyhow - would my proposed hybrid solution satisfy you ?

I think it mostly carries both sets of problems (of explicit shutdown
and atexit handlers) rather than solving both sets of problems.

 - Maciej




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