[libc-commits] [libc] [libc] add snmalloc as an alternative allocator to libc (PR #122284)

Matthew Parkinson via libc-commits libc-commits at lists.llvm.org
Sat Jan 18 02:44:55 PST 2025


mjp41 wrote:

> LLVM-libc atexit implementation calls malloc to obtain chunks when public packaging mode is enabled, which looks suspicious to me. We should probably change the behavior.
> 
> On the other hand, we can also call allocators cleanup hook (_malloc_thread_cleanup) internally since we do have full control of threads and main CRT startup/teardown in hermetic/fullbuild.

So `-DSNMALLOC_USE_THREAD_CLEANUP=On` will depend on `_malloc_thread_cleanup` being called, and define that symbol.  With that the code that calls `pthread` stuff and `atexit` should be removed from the code.

https://github.com/llvm/llvm-project/pull/122284


More information about the libc-commits mailing list