[EH] Fix inconsistency of refcounting in Emscripten EH vs. Wasm EH · Issue #17115 · emscripten-core/emscripten (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
The place we increase refcount is different in Emscripten EH and Wasm EH, which is explained in detail here:
#ifdef __USING_EMSCRIPTEN_EXCEPTION__ |
---|
// FIXME Currently Wasm EH and Emscripten EH increases |
// refcounts in different places. Wasm EH sets the refcount to |
// 1 when throwing, and decrease it in __cxa_end_catch. |
// Emscripten EH sets the refcount to 0 when throwing, and |
// increase it in __cxa_begin_catch, and decrease it in |
// __cxa_end_catch. Fix this inconsistency later. |
incrementExceptionRefcount(p); |
#endif |
So if you want to make the code work for both of them, you should put something like #ifdef
in the code to prevent memory from leaking. It'd be good to fix this inconsistency.