https://github.com/ivan-guerra/malloc
A Linux implementation of a memory allocator
https://github.com/ivan-guerra/malloc
linux malloc memory-management
Last synced: 27 days ago
JSON representation
A Linux implementation of a memory allocator
- Host: GitHub
- URL: https://github.com/ivan-guerra/malloc
- Owner: ivan-guerra
- License: mit
- Created: 2023-09-07T02:56:38.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-10T05:33:49.000Z (over 2 years ago)
- Last Synced: 2025-06-29T21:37:42.906Z (11 months ago)
- Topics: linux, malloc, memory-management
- Language: C++
- Homepage: https://programmador.com/posts/2023/a-beginners-memory-allocator/
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# malloc
This project includes a header-only implementation of a barebones memory
allocator. The allocator uses [mmap][1] under the hood to acquire a pool of
memory from the OS. All user requests and bookkeeping data structures are
maintained within this mmaped memory region. When servicing allocation requests,
a first fit algorithm is used to find free blocks. Upon the release of memory
blocks, memory is automatically compacted.
### Building
To build the project locally, you will need the following libraries and tools
installed:
* CMake3.27+
* C++ compiler supporting C++20 features
* [Doxygen][2]
To build the project, change directory to the `scripts/` directory and run
`build.sh`.
### Running the Tests
`malloc` has been unit tested using the GoogleTest framework in conjunction with
`ctest`. To run the tests, build the project and change directory to
`malloc/build/`. Run `ctest` to execute all unit tests.
### Doxygen Docs
The `malloc` API is documented using Doxygen. Doxygen docs are built
automatically by the build script. Docs can be found under
`malloc/docs/malloc/`.
[1]: https://linux.die.net/man/2/mmap
[2]: https://www.doxygen.nl/