Set Heapsize bevor initializing V8 VM

Jul 15, 2013 at 5:33 PM
Hi Guys,

I want to adjust the heap size of the V8 engine. In the Dokumentation.
In the documentation it says that I can set the heap before the initialization of VM.
http://bespin.cz/~ondras/html/classv8_1_1ResourceConstraints.html

But I do not know where it is...
I've tried to set it in the Constuctor of JavascriptContext but it had no use

JavascriptContext::JavascriptContext()
{
SetHeapLimit(100,100,120);
isolate = v8::Isolate::New();
v8::Locker v8ThreadLock(isolate);
v8::Isolate::Scope isolate_scope(isolate);
mExternals = new vector<JavascriptExternal*>();
mContext = new Persistent<Context>(Context::New());
}

bool JavascriptContext::SetHeapLimit(int youngSpace,int oldSpace,int maxExecutable)
{
    v8::ResourceConstraints rc;
    rc.set_max_young_space_size(youngSpace * 1024 * 1024); //64M
    rc.set_max_old_space_size(oldSpace * 1024 * 1024); // 64M
    rc.set_max_executable_size(maxExecutable * 1024 * 1024); //16M
    return v8::SetResourceConstraints(&rc);
}

Where could i set the Heap?

greetings
NeuRob
Developer
Jul 15, 2013 at 11:46 PM
Hi NeuRob,

This is because we are already calling SetResourceConstraints(), but later than you. See JavascriptContext::SetStackLimit().


Oliver