[webkit-dev] How does the Javascript garbage collection work?

Darin Adler darin at apple.com
Thu Sep 11 11:06:24 PDT 2008

On Sep 11, 2008, at 10:57 AM, Josh Chia (谢任中) wrote:

> Is it possible for a "false positive" on the stack to prevent an  
> object from being collected even after calling collect() multiple  
> times?

Sure. That's always theoretically possible with conservative garbage  
collection. But in practice this is unlikely and it is almost  
certainly not a practical problem. One of the things we do in WebKit  
is to make sure that garbage collection occurs when there is very  
little on the stack, by collecting at the "top level" of the event  
loop at key times (for example, when a window is closed).

In my experience so far, when diagnosing a problem where an object was  
not collected, it has always been due to another cause.

     -- Darin

More information about the webkit-dev mailing list