logoalt Hacker News

elehack • yesterday at 5:10 PM • 0 replies • view on HN

I don't think it's possible to implement thread-local “global” allocators. Since you need to use the same allocator to allocate and deallocate memory, transferring such objects across threads could transfer them to a thread without the right allocator — any data allocated with that allocator would need to be !Send, but the type system doesn't allow types to vary like that based on what allocator is active.