I found on another thread the same issue and it seems it could be solved 
forcing the global object to Null()

             for (int i=0; i<1000; i++) {
                // ...
                // ...
                v8::Handle<v8::Object> global = context1->Global();
                v8::Handle<v8::Array> global_property_names = 
global->GetPropertyNames();
                for (int i = global_property_names->Length() -1; i >= 0; 
i--)
                {
                    v8::Handle<v8::Value> key = 
global_property_names->Get(i);
                    v8::String::Utf8Value message(key->ToString());
                    std::string kk = *message;
                    v8::Handle<v8::Value> value = global->Get(key);
                    global->Set(key, v8::Null(isolate));
                }
                v8::V8::LowMemoryNotification();
             }

is it correct ?

On Tuesday, July 29, 2014 7:17:07 PM UTC+2, [email protected] wrote:
>
> I'm developing a pool of V8 instance (isolate+context) and I'm figuring 
> out some memory problem.
> I create a pair of isolate-context and I reuse it to run several script.
> Unfortunately the memory allocated by the script is not deleted (disposed).
> I simulate the behavior with a loop calling the script multiple times.
>     v8::Isolate* isolate = v8::Isolate::New();
>     {
>         v8::Isolate::Scope isolate_scope1(isolate);
>
>         for (int i=0; i<1000; i++) {
>             v8::HandleScope handle_scope1(isolate);
>             v8::Handle<v8::Context> context1 = v8::Context::New(isolate);
>             v8::Context::Scope context_scope1(context1);
>             v8::Handle<v8::String> source1  = ReadFile(isolate, script);
>             v8::Handle<v8::Script> script1 = v8::Script::Compile(source1);
>             v8::Handle<v8::Value> result1 = script1->Run();
>             v8::String::Utf8Value utf81(result1);
>             printf("%s\n", *utf81);
>         }
>     }
>     isolate->Dispose();
>
>
>  I used the following script:
> var l = 1024 * 1024 * 2
> var a = new Array(l);
>
> for( var i = 0, len = a.length; i < len; ++i ) {
>     a[i] = function(){};
> }
>
> What am I missing ?
>
> Thanks
> Fabio
>
>

-- 
-- 
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.

Reply via email to