Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/azer0s/pogmalloc

A poggers malloc implementation
https://github.com/azer0s/pogmalloc

garbage-collection garbage-collector malloc-free memory memory-allocation memory-allocator

Last synced: 3 days ago
JSON representation

A poggers malloc implementation

Awesome Lists containing this project

README

        

# pogmalloc(3)

A poggers malloc implementation

### Features

* Static allocator
* Real heap allocator (via `sbrk(2)`)
* Builtin GC
* Can also mark static memory
* Can be enabled via define
* Debug and trace logs
* Can be enabled via define
* Works on ARM & x86_64
* Works with GCC and clang

### Limitations

* Doesn't work on Windows
* Kinda flimsy tbh (it's cool and all but don't use it in prod lmao)
* GC doesn't work for packed structs or obfuscated pointers

### Credits

Credits to Tsoding and his amazing malloc series, this allocator was heavily inspired by his:
* https://github.com/tsoding/memalloc
* https://www.youtube.com/watch?v=sZ8GJ1TiMdk&ab_channel=TsodingDaily

#### Differences to memalloc

While pogmalloc was inspired by Tsodings memalloc, there are a couple of key differences. memalloc focuses on garbage collection, while
pogmalloc aims to be as dynamic as possible, providing just a barebones malloc algorithm with specific memory model implementations built
on top (I originally built pogmalloc as a bare metal OS allocator for an OSDev project). Furthermore, pogmalloc can allocate memory on the actual heap (thus is not limited to static data) and, from what I've gathered
in my quick (and truth be told, probably very inaccurate) testing, is faster than memalloc (but is also way less memory efficient than memalloc because
chunks are only squashed as a method of last resort).