pmed / v8pp

Bind C++ functions and classes into V8 JavaScript engine
http://pmed.github.io/v8pp/
Other
890 stars 120 forks source link

How to call a destructor of an object class explicitly #85

Closed zxbzswxr closed 5 years ago

zxbzswxr commented 5 years ago

I write an class with c++ , and export it and use it as addons in Node.js I create multiple objects , but I find that the object call its destructor only when Node exit, So even the object is assigned to a local var , the object can not be released until Node exit . Is there any advise or means that I can explicitly call the Destructor of an Object?

pmed commented 5 years ago

There is a v8pp::class_<T>::destroy_object(isolate, object_pointer) static function to destroy a wrapped C++ class T object.

zxbzswxr commented 5 years ago

@pmed Ok,I follow your advice and make it done !!! Thank you very much, I appreciate you work extremely !!!!

zxbzswxr commented 5 years ago

So ,I can Close it this issue.