On Mon, Nov 30, 2009 at 6:44 PM, Jens Alfke <[email protected]> wrote:

>
> On Nov 30, 2009, at 9:20 AM, Stephan Beal wrote:
>
> > Give us a RunGC() function which actually does a full GC run, and i'll be
> happy.
>
> while( V8::IdleNotification() )
>        ;
>
> This is not a hack, it's explicitly documented behavior — read the comment
> above the IdleNotification method in v8.h.
>

Thank you very much for that, Jens! The docs are't terribly clear on this
function's real use - i never would have surmised it by reading them:

-------------
Optional notification that the embedder is idle.

V8 uses the notification to reduce memory footprint. This call can be used
repeatedly if the embedder remains idle. Returns true if the embedder should
stop calling IdleNotification until real work has been done. This indicates
that V8 has done as much cleanup as it will be able to do.
-------------

Some suggestions for someone who's got commit access:

-----------
Optional notification that the embedder is idle.
-----------

"the embedder", to me, meant something internal to v8. i now understand it
to mean "the client [application]".

--------
V8 uses the notification to reduce memory footprint.
--------

_Which_ notification ("the" notification is unclear)?
Recommended rewording: "This notifies v8 that the client application is idle
(not using v8) and v8 can run a garbage collection."

Should there be a note about the client using v8::Unlocker in conjunction
with this function? (Or is this approach incompatible with Unlocker in some
way?)

--------
This call can be used repeatedly if the embedder remains idle.
--------

Again, "the embedder" is somewhat confusing until the meaning ("the client
application") finally sets in.

-----------
 Returns true if the embedder should stop calling IdleNotification until
real work has been done.
-----------

"real work has been done" is very misleading here. To me that means that my
app has done "real work", which it certainly is doing independent of any v8
usage.
Recommended re-wording: "... until v8 has been used sufficiently to create
collectible memory."

------------
 This indicates that V8 has done as much cleanup as it will be able to do.
------------

Since the original description doesn't really seem to refer to garbage
collection (only indirectly, via "to reduce memory footprint"), i would have
never understood that function to be useful as a GC trigger mechanism.

After reading it a few times and comparing that with your comments, it's
meaning is now clear, though.

Thanks again!

:-D

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to