Hi all,
I'm observing a memory leak when the script crashes at runtime. Here the
JavaScript code (made to crash on purpose by throwing Exception).
var res = new N1qlQuery('SELECT * FROM `sample`');
throw 'error'; // purposefully crash.
The corresponding C++ code for N1qlQuery is as follows -
void N1qlQuery(const v8::FunctionCallbackInfo<v8::Value> &args) {
v8::Isolate *isolate = v8::Isolate::GetCurrent();
v8::HandleScope handleScope(isolate);
v8::Local<v8::Name> query_name = v8::String::NewFromUtf8(isolate,
"query");
v8::Local<v8::Value> empty_string = v8::String::NewFromUtf8(isolate, "");
v8::Local<v8::ObjectTemplate> obj = v8::ObjectTemplate::New();
obj->Set(query_name, args[0]);
args.GetReturnValue().Set(obj->NewInstance());
}
I believe obj->NewInstance() is causing the memory leak, because I've
observed no memory leak when the last line in C++ was commented out, even
if the JavaScript crashed.
> There is no memory leak when the script finishes execution without
> crashing.
Could anyone please tell me the right way to expose a JavaScript class?
(perhaps by avoiding a call to NewInstance() in C++).
Thanks,
--Gautham
--
--
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.