Hi all.
Let's say I have a C++ function being exported to JavaScript, as simple as it
gets:
Handle<Value> Foo(const Arguments &args) {
char str[] = "blah blah blah";
Handle<String> result = String::New(str);
return result;
}
My first question is about the Handle<> contructed in the HandleScope of the
function's caller. Why should it lead to memory leaks, in the first place? Will
GC eventually collect it, or---for whatever reason---won't?
And the second one. What happens if I modify the function above to return a
reference?
Handle<Value> &Foo(const Arguments &args);
Now the handle itself is scoped out. Can _this_ possibly lead to memory leaks?
What if I define HandleScope handle_scope; at the beginning of the function
returning a reference?
I know I'm missing some fundamental concept here. :(
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---