This repository showcases a custom Memory Allocator written in C++.It handles:
- 🛠️ **Memory Allocation **
- 🗑️ Memory Deallocation
The core data structure is a bitmap*that tracks available memory.
- How it works:
Allocates memory by scanning the bitmap from left to right until it finds a large enough block. - Failure Case:
If there isn't enough space, the user gets an "Out of Memory" notification. - Efficiency: Quick but might leave gaps (fragmentation).
- How it works:
Scans the entire bitmap to find the smallest block large enough to fit the requested memory. - Outcome: Perfectly fits memory blocks where possible, minimizing wasted space.
- Trade-off: Takes more time due to full scans.
Cheese-like gaps in memory (enough total space but not contiguous) can cause allocation failures. 🧵
- Rearranges memory to consolidate free blocks.
⚠️ Note: This process is time-intensive and best avoided unless necessary.
- Reallocation: Create a best-fit memory layout for better performance.
- Granularity vs. Space: Balance block size for space efficiency.
Join the project! If you have any suggestions, optimizations, or enhancements, feel free to open a Pull Request or Issue. Every contribution matters!