https://github.com/madsmtm/linear-malloc
An ultra simple single-threaded linear allocator
https://github.com/madsmtm/linear-malloc
calloc custom-allocator linear-allocator malloc
Last synced: 4 months ago
JSON representation
An ultra simple single-threaded linear allocator
- Host: GitHub
- URL: https://github.com/madsmtm/linear-malloc
- Owner: madsmtm
- Created: 2022-02-22T00:50:40.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-22T00:50:54.000Z (over 3 years ago)
- Last Synced: 2025-01-13T21:37:11.845Z (6 months ago)
- Topics: calloc, custom-allocator, linear-allocator, malloc
- Language: Rust
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `linear-malloc`
[](https://crates.io/crates/linear-malloc)
[](https://docs.rs/linear-malloc/)# DISCLAIMER! This is a quick hack I did to test things. Don't use!
An ultra simple single-threaded linear allocator.
Useful to make the output of applications running under Cachegrind/Callgrind
more stable (since it doesn't try to do the clever optimizations that the
system allocator does).## Usage
Linux:
```sh
cargo build
LD_PRELOAD=./target/debug/liblinear_malloc.so your-binary
```macOS:
```sh
cargo build
DYLD_INSERT_LIBRARIES=./target/debug/liblinear_malloc.dylib DYLD_FORCE_FLAT_NAMESPACE=1 your-binary
```## Acknowledgements
Got some useful info about allocation strategies from [@mtrebi's `memory-allocators`](https://github.com/mtrebi/memory-allocators), and [@ezrosent's "Allocators in Rust"](https://github.com/ezrosent/allocators-rs) was a good source to help set up the basic framework.