> so what's the solution?

Runtime selection of the allocator plus some assertions that check in `spawn` 
that a shared allocator was involved in the memory that is passed over to a 
different thread.

But that's only a very rough idea.

Also note that "by default every allocation is shared" works for C/C++/Rust so 
the thread-local allocations might not as valuable as we thought it would be. 
In reality allocation needs lots of protection against bad allocation patterns 
and fragmentation which slows it down to the point that some syncronization on 
top of it may not matter much.

See 
[https://github.com/bytemaster/fc_malloc](https://github.com/bytemaster/fc_malloc)
 for a particularly interesting design that I would **love** to see a Nim port 
of.

Reply via email to