You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to emscripten-discuss
Hi, The Embind page states "To manage object lifetime with smart pointers, embind must be told about the smart pointer type", but I've created an object using a smart pointer constructor and once the JS object is removed, the object's destructor wasn't called.
This isn't surprising considering the prior statement "[...] there is no way for Emscripten to automatically call the destructors on C++ objects.", so it makes sense that Emscripten cannot call the smart pointer destructor. But, if smart pointers destructors aren't called, but the pointers' share count is incremented during their construction, the shared_ptr will never release its contained object. That is, while I could add a custom deleter for a raw pointer, I couldn't do that for a smart pointer.
Which statement is true? Do smart pointers manage the lifetime of the internal objects, or they don't?