Greetings,
I have been trying to embed v8 as plug-in for a certain program.
It works, however, I've discovered that when a script is compiled or
executed and failed, the memory is not freed immediately (even with
local handles).
I have this (test) function:
long test()
{
const char* p2 = ".error";
HandleScope handleScope;
Local<String> source = String::New((const char*)p1);
Local<Script> script = Script::Compile(source);
if(script.IsEmpty())
{
ReturnString("compilation error");
}
//Compiled successfully
Local<Value> result = script->Run();
if(result.IsEmpty())
{
ReturnString("execution error");
}
//Executed successfully
String::AsciiValue ascii(result);
ReturnStringSafe(*ascii);
}
script.IsEmpty() will be true, and "compilation error" is returned.
If I run this function a few thousand times, I can clearly see the
memory usage increase.
However, if I changed the string to, say, "1+2", which will work fine,
the memory usage does not increase.
So whenever one of the IsEmpty functions fail, the memory leaks (I
think).
Is there any explanation for this? I am positive that the rest of the
code (ReturnString etc.) does not leak!
Thanks for any information.
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users