https://github.com/rcmgleite/rlmalloc
Simple malloc implementation using "first fit" algorithm
https://github.com/rcmgleite/rlmalloc
malloc-free memory-allocation study
Last synced: 9 months ago
JSON representation
Simple malloc implementation using "first fit" algorithm
- Host: GitHub
- URL: https://github.com/rcmgleite/rlmalloc
- Owner: rcmgleite
- Created: 2017-05-15T02:30:42.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-17T12:36:08.000Z (about 9 years ago)
- Last Synced: 2025-06-27T10:47:53.546Z (about 1 year ago)
- Topics: malloc-free, memory-allocation, study
- Language: C
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rlmalloc
This a simple implementation of malloc using the first fit algorithm. It's NOT PRODUCTION READY and was created just for academic purposes.
## System requirements
Please use Linux.
## Compile
To compile the example on main.c just execute:
```
$ make
```
## main.c
This file uses rlmalloc and rlfree to manager memory with some simple examples.
## bibliography
- [Malloc tutorial](http://www.inf.udec.cl/~leo/Malloc_tutorial.pdf)
- [Simple malloc impl](https://danluu.com/malloc-tutorial/)
- [Redis zmalloc](https://github.com/antirez/redis/blob/unstable/src/zmalloc.c#L176)
- [Zero length array - C](http://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html)
- [Memory Alignment](http://stackoverflow.com/questions/3994035/what-is-aligned-memory-allocation/3994235#3994235)
## TODO's
- [ ] Create better tests.
- [ ] Keep track of memory usage. (eg: [zmalloc](https://github.com/antirez/redis/blob/unstable/src/zmalloc.c))
- [ ] Thread safety.
- [ ] Create statistics getters (eg: number of blocks).
- [ ] Benchmark.