-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix __cxa_find_matching_catch's memory leak #8947
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
This can be slightly simpler: a new global variable (__cxa_find_matching_catch_buffer
) is not needed, as you can write
var buffer = {{{ makeStaticAlloc(4) }}};
inside the one function that uses that buffer (the {{{ .. }}}
will be expanded out into the absolute address in memory). lgtm with that.
Hmm that CI error on I think the issue is that we include that JS file based on |
|
`__cxa_find_matching_catch` allocated a buffer of size 4 using `malloc` only when it was first called and reused it through the entire program run. And this malloc'ed memory wasn't freed. Because this is only allocated once, I changed it to a static allocation using `makeStaticAlloc`. Fixes emscripten-core#8919.
__cxa_find_matching_catch
allocated a buffer of size 4 usingmalloc
onlywhen it was first called and reused it through the entire program run. And this
malloc'ed memory wasn't freed. Because this is only allocated once, I changed it
to a static allocation using
makeStaticAlloc
.Fixes #8919.