[webkit-dev] number of wrapped objects in JSC

2012-03-19 Thread Jochen Eisinger
Hey,

I intend to add a graph in the inspector's timeline panel that shows the
number of global handles for V8. The V8 bindings use maps for WebCore
objects to global handles to V8 wrapper objects. A steady increase of
global handles is often a sign of a memory leak within v8 bindings.

My question to the JSC folks is, is there a similar counter in JSC? I.e.
something that corresponds to the number of wrapped WebCore objects (and
potentially other objects that are kept alive without necessarily being
reachable from javascript)?

thanks
-jochen
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] number of wrapped objects in JSC

2012-03-19 Thread Geoffrey Garen
 I intend to add a graph in the inspector's timeline panel that shows the 
 number of global handles for V8. The V8 bindings use maps for WebCore objects 
 to global handles to V8 wrapper objects. A steady increase of global handles 
 is often a sign of a memory leak within v8 bindings.

Are you sure that all wrappers go into a map? What about wrappers for 
ScriptWrappable objects?

 My question to the JSC folks is, is there a similar counter in JSC? I.e. 
 something that corresponds to the number of wrapped WebCore objects (and 
 potentially other objects that are kept alive without necessarily being 
 reachable from javascript)?

You could read the length of JSC::HandleHeap::m_weakList. Since that's an 
expensive operation, I'd suggest computing the length during garbage collection 
and then caching it.

Geoff
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] number of wrapped objects in JSC

2012-03-19 Thread Jochen Eisinger
On Mon, Mar 19, 2012 at 9:47 PM, Geoffrey Garen gga...@apple.com wrote:

  I intend to add a graph in the inspector's timeline panel that shows the
 number of global handles for V8. The V8 bindings use maps for WebCore
 objects to global handles to V8 wrapper objects. A steady increase of
 global handles is often a sign of a memory leak within v8 bindings.

 Are you sure that all wrappers go into a map? What about wrappers for
 ScriptWrappable objects?


That's right, not all objects are kept in maps, but all objects have a
global handle somewhere.



  My question to the JSC folks is, is there a similar counter in JSC? I.e.
 something that corresponds to the number of wrapped WebCore objects (and
 potentially other objects that are kept alive without necessarily being
 reachable from javascript)?

 You could read the length of JSC::HandleHeap::m_weakList. Since that's an
 expensive operation, I'd suggest computing the length during garbage
 collection and then caching it.


awesome, thanks

-jochen




 Geoff

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev