Dan Mosedale wrote:

>>I think the factory object helps track the number of references
>>to the shared library/dll to help determine whether it is safe to
>>unload it from memory.
> 
> As far as I know, unloading isn't actually implemented in XPCOM yet,
> precisely because no ref-counting is done on the shared library
> itself.

Unloading isn't implemented because we're losers.  The component manager 
has long had code to unload libraries if they said it was acceptable (by 
returning a true value from their nsIModule::canUnload implementation), 
but we turned it off because lots of our modules returned true 
_blindly_, resulting in crashes.

We need to fix that for 1.0, even if none of our components will ever 
permit themselves to be unloaded, because other component creators may 
wish to be more diligent and do the bookkeeping.  (Our nsGenericModule 
stuff could actually do most of the bookkeeping for in-Mozilla 
components, I expect.)

There's no need for reference counting on the shared library itself: 
there is no way that anything other than the XPCOM component manager 
should be loading or unloading component libraries.  If that happens, 
we've already lost.

Mike


Reply via email to