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:
parent
207158fcdb
commit
7f48722d72
2 changed files with 8 additions and 5 deletions
|
@ -19,11 +19,9 @@ extern "C" {
|
||||||
String::Init();
|
String::Init();
|
||||||
Locker::Init();
|
Locker::Init();
|
||||||
|
|
||||||
// GC::Init();
|
|
||||||
// Accessor::Init();
|
// Accessor::Init();
|
||||||
// Invocation::Init();
|
// Invocation::Init();
|
||||||
// Signature::Init();
|
// Signature::Init();
|
||||||
// Object::Init();
|
|
||||||
// Array::Init();
|
// Array::Init();
|
||||||
// Function::Init();
|
// Function::Init();
|
||||||
// Date::Init();
|
// Date::Init();
|
||||||
|
|
11
ext/v8/ref.h
11
ext/v8/ref.h
|
@ -49,7 +49,7 @@ namespace rr {
|
||||||
return Qnil;
|
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;
|
v8::Persistent<T>* handle;
|
||||||
bool disposed_p;
|
bool disposed_p;
|
||||||
|
|
||||||
static void enqueue(Holder* holder) {
|
static void destroy(Holder* holder) {
|
||||||
// TODO
|
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);
|
// GC::Finalize(holder);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue