static void gum_script_event_sink_data_free (Persistent<Value> object, void * buffer) { int32_t size; HandleScope handle_scope; size = object->ToObject ()->Get (String::New ("length"))->Uint32Value (); V8::AdjustAmountOfExternalAllocatedMemory (-size); g_free (buffer); object.Dispose (); }
static void gum_script_file_on_destroy (Persistent<Value> value, void * data) { (void) data; HandleScope handle_scope; Local<Object> object (value->ToObject ()); FILE * file = static_cast<FILE *> (object->GetPointerFromInternalField (0)); if (file != NULL) fclose (file); value.Dispose (); }
void DisposeOpenCLObject (Persistent<Value> value, void* release) { if (release && value->IsObject()) { Local<Object> object = value->ToObject(); if (object->InternalFieldCount()) { void *ptr = object->GetPointerFromInternalField(0); int32_t (CALL *clRelease) (void* smth); *(void**) &clRelease = release; clRelease(ptr); // Returned value is omitted. Check when debugging. } } value.Dispose(); value.Clear(); }