Hi there
I'm actually working on a virtual memory allocator and I would like to read your opinion on it. It's only a firt work and I'm not sure if it can be efficient enough and fast enough but, again, it's a first work.
You can find a graphical explanation down here ^^
- Each block is a header with random space
- Each header contain size and un bool (free or not)
- Each block is fully adjacent
- To find the next block you only need to add size + sizeof(header) to the pointer value
- The heap is initialized with a unique free block
- When you want to use a block, you find the first free block big enough, split it if needed, mark a part as used and the other as free, and return the address after the header
- When you want to free a block, you find it, mark it as free and see both adjacent if they are free for merge or not
- When no more free block can be found, we just ask PA to give use an other page if availbable
I'm think the biggest problem is the operation to find the next one and maybe the internal fragmentation.
What do you think ? Love to learn ^^