Allocating byte arrays of memory from fixed memory block

  allocator, boost, c++, memory-management, memory-pool

How can I use boost pool or some other similar allocator technique to allocate contiguous 512 byte sectors from a fixed block of memory. I am trying to emulate a memory filesystem in C++17.

I assume that under the covers, when a user creates a new file of a specified length, a separate filesystem metadata object could be used to associate the filename with a root pointer/length node within this memory block/pool.

If the file is appended or truncated at a specified offset less than the current length, additional linked list nodes would need to be added or removed from the root node mentioned above. Defragmentation would be nice but optional. Given that the minimum sector allocation size is 512 bytes, small allocations/appends to the file may not require additional linked list nodes to be added if the sector is not fully used.

I am not sure if what I described above exists as a simple library or if the boost pool does this for me as is. I just want to allocated blocks of bytes, not arrays of objects.

Source: Windows Questions C++

LEAVE A COMMENT