[webkit-dev] Leak reports during shutdown

Kevin Ollivier kevino at theolliviers.com
Tue Sep 29 11:08:09 PDT 2009


Hi all,

For a while, ports like wx and Win/Cairo have been seeing various  
leaks reported on shutdown, but at least on Mac I've been unable to  
see these leaks using memory leak checkers like the one in  
Instruments, so I decided to poke into the code a bit more and try to  
understand what's going on a bit better.

What I found was that the reported object leaks were pretty much all  
related to objects that JSC has references to. Changing  
~ScriptController to do a garbageCollectNow() instead of  
garbageCollectSoon(), for example, drastically reduced the number of  
reported leaks, cleaning up all the CachedResource leaks and almost  
all the WebCoreNode leaks. The remaining leaks were almost all  
JSC::Structure objects. I've been digging through the code to try and  
find the place where these JSC objects are finally deleted, but I  
haven't found anyplace obvious in the code, neither in common code nor  
in the ports' code.

My question is, is there somewhere these objects are being deleted on  
final shutdown that apparently happens after the leaks are reported,  
or does WebKit have assumptions such as that all still running timers  
must fire before final shutdown that ports such as ours are not  
honoring? (e.g. in my tests garbageCollectSoon() does not end up  
firing the callback because the app shuts down too fast.)

Thanks,

Kevin


More information about the webkit-dev mailing list