hubgeter commented on code in PR #69819: URL: https://github.com/apache/doris/pull/69819#discussion_r4421360991
########## be/src/runtime/memory/jemalloc_hook.cpp: ########## @@ -77,6 +77,12 @@ void* realloc(void* p, size_t size) __THROW ALIAS(doris_realloc); void* calloc(size_t n, size_t size) __THROW ALIAS(doris_calloc); void cfree(void* ptr) __THROW ALIAS(doris_cfree); void* memalign(size_t align, size_t size) __THROW ALIAS(doris_memalign); +#ifdef __GLIBC__ +// Before glibc 2.25, dlopened modules allocate dynamic TLS with __libc_memalign +// and release it through free. Route both to jemalloc so thread exit does not +// pass a glibc allocation to doris_free. +void* __libc_memalign(size_t align, size_t size) __THROW ALIAS(doris_memalign); +#endif Review Comment: Current master still includes this hook in Linux builds with USE_JEMALLOC=ON, and jemalloc still uses the je symbol prefix. I ran a minimal link test using the current master sources: with the hook, public malloc/free calls resolve to the jemalloc wrappers; without it, they resolve to libc. So the hook still provides allocator interposition. This PR fixes the mismatch between TLS allocation and deallocation under the existing configuration. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
