Embedding v8 4.6.88.

Suppose my native function sequence() returns a JavaScript iterable 
wrapping a long sequence of internal objects; function gc() invokes 
v8::Isolate::LowMemoryNotification().  To reduce memory consumption of the 
iterable, gc() needs to be called periodically to release the objects no 
longer referenced by the script.

The following script is able to iterate through the sequence to the end, 
and when gc() is called, no weak callback is called to the object backing s:

var i = 0; var s = sequence(); for (doc of s) { i++; if (i%1000 == 0) gc(); 
} i

==> 131108


However, if no variable s is defined, the execution stops after the first 
gc, because the object returned from sequence() is also collected at gc:

var i = 0; for (doc of sequence()) { i++; if (i%1000 == 0) gc(); } i

==>1000


This looks like a bug to me.  Can anyone chime in?

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to