WinCE/ARM memory leak after Context::New() in a thread

36 views
Skip to first unread message

neil...@hotmail.com

unread,
May 20, 2009, 7:13:26 AM5/20/09
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

Avadhut Bhangui

unread,
Sep 27, 2016, 1:39:00 PM9/27/16
to v8-users, neil...@hotmail.com
Hello,

Currently i'm trying to build V8 engine on Win CE ARM. Can you please share the steps you followed.

/Avadhut.

Jochen Eisinger

unread,
Sep 28, 2016, 11:57:25 AM9/28/16
to v8-u...@googlegroups.com, neil...@hotmail.com
This doesn't look WinCE/ARM related. Instead, you appear to never free the persistent handle which then keeps the context alive indefinitely.

I propose to first learn about v8 basics in a less constrained environment, and once you got that working, move on to porting your code to wince.

best
-jochen

--
--
v8-users mailing list
v8-u...@googlegroups.com
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 v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages