|
|
|
|
|
by exDM69
782 days ago
|
|
Correct me if I'm wrong but can't you put a Rc<RefCell<OffsetAllocator>> in your std::alloc::Allocator implementation for interior mutability? This make a non-thread safe allocator, with the (desired) side effect of making anything allocating from it (e.g. Vec) a !Send. Or is there a requirement that Allocators must be Sync and Send? |
|
(More practically, you can just write a GlobalAlloc that forwards to an instance of a thread-local allocator. Though that runs the risk of thread-local deinitialization running in an unexpected order.)