Compile the program below and run it with valgrind you will get a few 
errors similar to below:

==3118==    at 0x4C2AC27: operator new[](unsigned long) (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==3118==    by 0x440D0C: 
v8::internal::Debugger::Debugger(v8::internal::Isolate*) (in 
/home/weidong/workspace/mylib/samples/v8/test)
==3118==    by 0x4F699A: v8::internal::Isolate::InitializeDebugger() (in 
/home/weidong/workspace/mylib/samples/v8/test)
==3118==    by 0x4F6A67: 
v8::internal::Isolate::Init(v8::internal::Deserializer*) (in 
/home/weidong/workspace/mylib/samples/v8/test)
==3118==    by 0x5DB539: v8::internal::Snapshot::Deserialize(unsigned char 
const*, int) (in /home/weidong/workspace/mylib/samples/v8/test)
==3118==    by 0x5DB5B5: v8::internal::Snapshot::Initialize(char const*) 
(in /home/weidong/workspace/mylib/samples/v8/test)
==3118==    by 0x408A7A: v8::FunctionTemplate::New(v8::Handle<v8::Value> 
(*)(v8::Arguments const&), v8::Handle<v8::Value>, 
v8::Handle<v8::Signature>) (in 
/home/weidong/workspace/mylib/samples/v8/test)

Question is: is the reported memory leak true or not? I thought there 
shouldn't be any problem to cause memory leaks in the example program.

Example program:

#include "v8.h"
using namespace v8;

Handle<Value> Foo(const Arguments& args) {
  return Undefined();
}

int main(int argc, char **argv) {
    HandleScope scope;
    Handle<FunctionTemplate> f1 = FunctionTemplate::New(Foo);
    Persistent<FunctionTemplate> f2 = Persistent<FunctionTemplate>::New(f1);
    f2.Dispose();
    return 0;
}

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to