Traverse-Research / gpu-allocator

🦀 GPU memory allocator for Vulkan, DirectX 12 and Metal. Written in pure Rust
https://traverse.nl/
Apache License 2.0
373 stars 49 forks source link

Should Allocation really implement Clone? #97

Closed danielkeller closed 2 years ago

danielkeller commented 2 years ago

I'm pretty sure that the implementation of Clone for Allocation is unsafe, because you can clone it and call mapped_slice_mut on both, getting two &muts that alias.

MarijnS95 commented 2 years ago

Oh yeah, that's entirely correct. There are more UB issues such as getting &mut access to possibly uninitialized memory, which is going to be fixed when I pick https://github.com/Traverse-Research/gpu-allocator/tree/uninit back up :grimacing: