-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embind regression: Leaked C++ object when calling from C++ to JS #22575
Comments
Thanks for the nice reproducer. I don't think we considered this specific case when making the changes above (nor do we have a test case that really covers it). The old behavior in this case is much nicer, but I'd still like
|
...due to <emscripten-core#22575> "Embind regression: Leaked C++ object when calling from C++ to JS"
Any news on this one? I am experiencing the same... The project I work in has been using 3.1.48 for more than a year now and I wanted to update emscripten to the current latest. I didn't get far. After this release, I start seeing allocations errors because apparently there are plenty of memory leaks now 😅 . Thanks! Edit: Did you find any better workardound @stbergmann ? Update: |
I originally mentioned this in a comment at #21022 (comment) "embind: Don't automatically destroy arguments passed into val calls. (#21022)", but it likely got missed there:
Since 6e54690 "embind: Don't automatically destroy arguments passed into val calls. (#21022)" was merged into 3.1.52, the below test program behaves differently than before, and I wonder whether that's intentional. The test setup is
and
Until 3.1.51 (also in 3.1.47 and 3.1.48, i.e., irrespective of 12777ca "[emval] Reuse method calling optimisation in regular calls (#20383)" that was merged into 3.1.48 and motivated this change), the browser console logs were
That is., the instance of
Smart
used in the call to JSifc.memFun(*s);
from C++useInterface
is properly destroyed.Since 3.1.52, the browser console logs instead are
That is, the instance of
Smart
used in the call to JSifc.memFun(*s);
from C++useInterface
is leaked now. But even if the new behavior is intentional: Where should that instance be destroyed? I think this commit assumes that the JS implementationshould
smart.delete();
it now. But then, that would apparently break the sequence of direct JS to JS callsfrom within
jsRun
.The text was updated successfully, but these errors were encountered: