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?

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CA%2B_KjGb1aLbEV_2uhxoUTW-y58Cfayou%3DWGDYPVfedjBPyiXOA%40mail.gmail.com.

Reply via email to