Hi,
I have modified the standard platform-win32.cc to build under CE (a
few minor changes) and built an ARM v8 lib.
When I link to this I can create a global ObjectTemplate, create a new
Context from it and compile/run scripts fine provided I do this in the
main application thread.
If I create a thread via CreateThread() and run the same code I leak
~2.1mb for every thread I create. The thread appears to return
correctly and the HandleScope destructor is entered.
The code I'm using in the thread is:
{
Locker locker;
Locker::StartPreemption(100);
HandleScope handle_scope;
Persistent<Context> context = Context::New(NULL, script_global);
Context::Scope context_scope(context);
t = GETTICKSMS;
TryCatch try_catch;
Handle<Script> script = Script::Compile(String::New(thread-
>code.c_str()));
rv = !script.IsEmpty();
if (!rv)
{
str.Format("JavaScript compilation error: %s",
script_extracterror(&try_catch).c_str());
log_add("script_thread(): %s", str.c_str());
}
else
{
Handle<Value> result = script->Run();
rv = !result.IsEmpty();
if (!rv)
{
str.Format("JavaScript runtime error: %s",
script_extracterror(&try_catch).c_str());
log_add("script_thread(): %s", str.c_str());
}
}
context.Dispose();
context.Clear();
}
If I just leave the Locker and HandleScope the leak goes away.
Any ideas?
Thanks,
Neil
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---