Status: New
Owner: ----
New issue 733 by [email protected]: V8 fails to collect FunctionTemplate
instances
http://code.google.com/p/v8/issues/detail?id=733
Functions created through a FunctionTemplate don't seem to be
garbage-collected. This is a
serious leak IMHO. Tested against trunk:
#include <v8.h>
using namespace v8;
void WeakCallback (v8::Persistent<v8::Value> value, void *data) {
fprintf(stderr, "Weak: %s\n", (char*)data);
}
int main(int argc, char **argv) {
V8::SetFlagsFromCommandLine(&argc, argv, true);
HandleScope scope;
Persistent<Context> context = Context::New();
Context::Scope context_scope(context);
{
HandleScope block;
#define REGISTER(exp) Persistent<Value>::New(exp).MakeWeak((void*)#exp,
WeakCallback)
// THIS ONE IS NOT IDENTIFIED BY THE GC:
REGISTER(FunctionTemplate::New()->GetFunction());
// THESE ARE:
REGISTER(FunctionTemplate::New()->GetFunction()->NewInstance());
REGISTER(ObjectTemplate::New()->NewInstance());
REGISTER(Object::New());
}
Handle<Array> waste = Array::New();
while(true) {
waste->Set(waste->Length(), v8::Null());
}
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev