Hello everyone - I'd like some feedback with regard to a sample addon I've put together for node to demonstrate exposing a C++ library to javascript. In particular, I'm struggling with how to properly manage memory allocated from C++ when its lifetime is coupled to the lifetime of a javascript handle.
The repository is on Github at https://github.com/mattness/addonSample. Specifically, I'm looking for help with the following: https://github.com/mattness/addonSample/blob/master/src/binding.cc#L53(Freeing a C++ heap-allocated object when JS object it's tied to gets GC'd) https://github.com/mattness/addonSample/blob/master/src/native_object_wrapper.cc#L23 (Whether or not a v8::ObjectTemplate can be defined once and reused) https://github.com/mattness/addonSample/blob/master/src/native_object_wrapper.cc#L38 (The appropriate use of Persistent handles, and when/where to call Dispose and Clear) Any other feedback is welcome as well. Thanks so much for your time! Matt -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en