Blocks with ownership: a novel approach to CPU and GPU memory in C++
In 2015 Alexandrescu proposed that an allocation should be a block (pointer + size), not a bare pointer.
bx::Blk takes that idea further. The block is the single owner of its memory (no accidental copies or double frees), carries an 8-bit handle to the allocator that created it, and works for both CPU and GPU memory. The same allocators (TLSF, first-fit, etc.) suballocate RAM and VkDeviceMemory/ID3D12Heap.
A general-purpose heap composed from these parts is in the same group as mimalloc/snmalloc/rpmalloc and faster than some well known general purpose allocators.
Read more here: https://bkaradzic.github.io/posts/memory-management/
全文完



