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();
|
||||
Locker::Init();
|
||||
|
||||
// GC::Init();
|
||||
// Accessor::Init();
|
||||
// Invocation::Init();
|
||||
// Signature::Init();
|
||||
// Object::Init();
|
||||
// Array::Init();
|
||||
// Function::Init();
|
||||
// Date::Init();
|
||||
|
|
11
ext/v8/ref.h
11
ext/v8/ref.h
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue