Issue 129: Memory consumption hyperoscillations
http://code.google.com/p/v8/issues/detail?id=129

Comment #17 by victor.grishchenko:
OK. I wrote a micro memory profiler. It turns out I really did not release  
persistent handles for temporary
objects. Actually, I previously did, but I apparently rewrote the code  
after a misleading example when I was
trying to workaround the actual VM leak. Anyway,

void BufferDestroy(Persistent<Value> self, void* parameter) {
        evbuffer_free((evbuffer*)parameter);
-       self.ClearWeak();
+       self.Dispose();
}

Handle<Value> BufferCreate (const Arguments& args) {
        if (!args.IsConstructCall())
                jsthrow("cannot call constructor as function");
        HandleScope scope;
        evbuffer * buf = evbuffer_new();
        Persistent<Object> self = Persistent<Object>::New(args.This());
        self.MakeWeak(buf, BufferDestroy);
        self->SetInternalField(0,External::New(buf));
        return args.This();
}

Now it seems funny.



-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

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

Reply via email to