neil...@hotmail.com
unread,May 20, 2009, 7:13:26 AM5/20/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to v8-users
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