I call this inside a c++ function, so it definitely goes out of the scope with the whole handle_scope... but memory isn't being freed
On Sat, Jan 9, 2016 at 5:47 PM, Ben Noordhuis <[email protected]> wrote: > On Sat, Jan 9, 2016 at 3:23 PM, Sergey F. <[email protected]> wrote: > > I also creates SO question regarding v8 behavior with some code attached, > > please see: > > > http://stackoverflow.com/questions/34694591/v8-impossible-to-free-memory-allocated-by-context > > Reproducing your example here for posterity: > > Isolate::CreateParams create_params; > create_params.array_buffer_allocator = &array_buffer_allocator; > > Isolate* isolate = Isolate::New(create_params); > Locker locker(isolate); > Isolate::Scope isolate_scope(isolate); > HandleScope handle_scope(isolate); > > Local<Context> ctx = Context::New(isolate); > Context::Scope context_scope(ctx); > > Local<Script> script; > Local<String> name = String::NewFromUtf8(isolate, "wtf.js"); > Local<String> source = String::NewFromUtf8(isolate, "var a = []; > for(var i = 0; i < 300; i++) a.push(new Array(1000000).join('*'));"); > ScriptOrigin origin(String::NewFromUtf8(isolate, "wtf.js")); > > script = Script::Compile(ctx, source, &origin).ToLocalChecked(); > Handle<Value> result = script->Run(ctx).ToLocalChecked(); > > The first thing that stands out to me is that |ctx| is scoped to the > lifetime of |handle_scope|, i.e., |ctx| won't be eligible for garbage > collection until |handle_scope| goes out of scope. > > -- > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to a topic in the > Google Groups "v8-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/v8-users/z3bVyJRyCf4/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
