2010/2/22 deadmorous <[email protected]>: > Finally I have found the solution. > 1. The "alternative" version of constructor jsnative_myobj() should be > used (it is commented out in the code in my previous post above). > 2. Persistent handles are created using Persistent::New(). So, the > line > Persistent<Object> obj( objTpl->NewInstance() ); > in jsnative_myobj() has to be replaced with the following one: > Persistent<Object> obj = Persistent<Object>::New( objTpl- >>NewInstance() ); > With these modifications, the callback RemoveMyObj() gets called at GC > time, so I can go further in using V8.
You might find this simple object wrapper useful - it will call the c++ destructor when the object is GCed. http://github.com/ry/node/blob/bb0d1e65e1671aaeb21fac186b066701da0bc33b/src/node_object_wrap.h Here is an example usage: http://github.com/ry/node/blob/bb0d1e65e1671aaeb21fac186b066701da0bc33b/src/node_idle_watcher.cc -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
