libwapcaplet - memory leak?

François Revol revol at free.fr
Tue Feb 26 13:50:24 GMT 2013


On 26/02/2013 14:11, Rob Kendrick wrote:
> On Tue, Feb 26, 2013 at 01:08:33PM +0000, Daniel Silverstone wrote:
>> On Tue, Feb 26, 2013 at 01:10:41PM +0100, François Revol wrote:
>>> At least on BeOS we can in theory include NetSurf as a replicant, where
>>> the binary is dlopen()ed and dlclosed() when removed, so using atexit()
>>> would cause quite some trouble there.
>>
>> If this is *truly* a use-case we need to think about, I'll ponder making the
>> root somehow static so it gets unloaded automatically, although that might
>> complicate rehashing.
> 
> The ugly destructor approach could be workable: if for some reason a
> host's compiler doesn't support it, we can wrap it in a suitable #ifdef
> and they can deal with the leak.
> 
> Or, perhaps we could have some C++ with a real destructor on a singleton
> that calls the finialisation code?  Not sure how this would interact
> with multiple users an dlopen()ing of the whole thing.

Well, C++ dtors are usually called from this method anyway...
it's just more standardized at C++ level.

François.



More information about the netsurf-dev mailing list