Reputation: 1015
I have the array of size n which represents my main memory. I can not use operator new, I have only access to that memory so every data structure must use only that array to store data. I am trying to build memory allocator which will be able to quickly find free portions of that memory (array) and also free them. I want to build tree structure over that array - buddy memory allocation - but I am struggling with understanding few concepts.
How exactly is buddy system looking for free chunk of memory using binary tree ?
How should I store this tree in the array ?
How can I create new nodes of that tree (should I just reserve enough space for my tree at the beginning of the program or "allocate" it dynamically - but how to do it simply) ?
I kinda have the answers to these questions but I am struggling with fully understanding it. I would appreciate every clear answer and help. Thank you.
Upvotes: 0
Views: 1209
Reputation: 2095
Upvotes: 1