Skip to content

StiliyanDr/allocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

allocator

A C++14 implementation of the buddy memory allocation algorithm.

Main features

The algorithm is encapsulated in an object which is constructed with a pointer to the memory block to be managed and its size.

Allocation and deallocation take time O(logN), where N is the first power of two greater-than or equal to the managed block's size.

In terms of memory consumption for bookkeeping, no more than 5-6% of the memory block is used for big enough blocks, say bigger than 1KB. For large blocks, say at least 4KB, the memory consumption becomes insignificantly small - around 1-2%. The algorithm is not well suited to small allocations so the second figure is more indicative.

Move operations are also supported. The object's behaviour is illustrated in its unit tests.

Documentation

Documentation, notes on algorithm design, complexity and correctness can be found in the project's docs.

Testing

The project's unit tests are written with Catch2 and can be found here.

References

Allocation Adventures 3: The Buddy Allocator
The Art of Computer Programming, Vol. 1, Donald Knuth

About

A C++14 allocator implemented with buddy allocation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages