Have you considered using mimalloc? I gather it has a similar design to snmalloc, but mimalloc is written in C.
Re:Snmalloc: A Message Passing Allocator
by gavinhoward on Thursday October 12, 2023 @10:01AM
(#37857286)
I did, but I don't want to have a dependency on Microsoft code.
Plus, there are some changes I will make to make my snmalloc/mimalloc clone more friendly to structured concurrency. Nothing major, stuff to mostly deal with realloc().
I'm going to reimplement snmalloc in C for my own code.
I'm going to avoid that problem by using structured concurrency. Under my system, threads only get data from threads that are ancestors. (There will be a way of getting data from a non-ancestor, but it will effectively keep the allocating thread alive until the using thread is done.)
The reason I'm going to use snmalloc is because of structured concurrency; it's like it was designed for structured concurrency.