On Wed, Apr 14, 2010 at 12:57 PM, Matthias Ernst <[email protected]>wrote:
> On Tue, Apr 13, 2010 at 5:05 PM, Stephan Beal <[email protected]> > wrote: > > Another tip: get rid of the HandleScopes. i've spent many hours > > experimenting and they cause me nothing but grief. Mysterious segfaults > when > > a bound function returns? 9 times out of 10 it's caused by the mere > > existence of a HandleScope. i don't use them at all any more, and i can't > > see a functional difference (other than that my apps don't crash when the > > bound functions return, unless i've done something else illegal). > > That is a tip on the verge of FUD ;-) Can you be any more specific > about your problems? It sounds to me like you're accessing a Local after the HandleScope in which it was created went away. > It probably does sound like unqualified FUD, but it's a topic i've mentioned on the list several times and never seen a concrete solution for. Nor have i ever heard a concrete reason as to why HandleScopes are so important in client code (as opposed to inside the v8 engine). The VM should (and does, _i assume_) add a scope when a function is called, and local vars created in that scope should become eligible for GC when the function returns. i (as the client/embedder) shouldn't need an explicit scope to ensure that (my InvocationCallback function body is all the scope i need). Only in certain local scopes which create oodles of objects in a loop would i consider adding a HandleScope. MANY times i've encountered post-function-return crashes simply because i instantiated a HandleScope in the function. After finally recognizing that the HandleScopes caused (or were one cause of) my crashes, i stopped using them. i haven't had any post-v8::InvocationCallback-return crashes since then except where i've done something else was illegal. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
