1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

Dispose of the persistent handles when they are GC'd by ruby

This commit is contained in:
Georgy Angelov 2015-03-22 10:05:49 +00:00
parent 207158fcdb
commit 7f48722d72
2 changed files with 8 additions and 5 deletions

View file

@ -19,11 +19,9 @@ extern "C" {
String::Init();
Locker::Init();
// GC::Init();
// Accessor::Init();
// Invocation::Init();
// Signature::Init();
// Object::Init();
// Array::Init();
// Function::Init();
// Date::Init();

View file

@ -49,7 +49,7 @@ namespace rr {
return Qnil;
}
return Data_Wrap_Struct(Class, 0, &Holder::enqueue, new Holder(handle));
return Data_Wrap_Struct(Class, 0, &Holder::destroy, new Holder(handle));
}
/*
@ -105,8 +105,13 @@ namespace rr {
v8::Persistent<T>* handle;
bool disposed_p;
static void enqueue(Holder* holder) {
// TODO
static void destroy(Holder* holder) {
holder->dispose();
// TODO: This previously enqueued the holder to be disposed of
// in `AddGCPrologueCallback`. Now that `AddGCPrologueCallback` depends
// on an active Isolate (and must be registered for each one) it
// might be better to just dispose of the object on the spot.
// GC::Finalize(holder);
}
};