I don’t want to distract from the main discussion here, but this is a perfect example of the pitfalls of having static mut
available, which is part of the reason I proposed removing it.
You’re lacking any kind of synchronization around accesses to wrappers
, which is UB AFAIK, given multithreading.
I think the best option here would be AtomicPtr
, with sequentially consistent writes and relaxed reads.
As for the rest of the proposal, I have nothing against it, and I’ve previously found myself wishing I had a way to visualize all the allocations, including type information (preferably in a debugger-friendly form).