Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gubnik/arena_allocator
A very simple C++ arena allocator
https://github.com/gubnik/arena_allocator
allocator arena-allocator cplusplus cpp educational educational-project memory memory-management
Last synced: about 1 month ago
JSON representation
A very simple C++ arena allocator
- Host: GitHub
- URL: https://github.com/gubnik/arena_allocator
- Owner: gubnik
- Created: 2024-09-15T22:56:04.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-09-15T23:06:06.000Z (2 months ago)
- Last Synced: 2024-09-26T01:29:51.977Z (about 2 months ago)
- Topics: allocator, arena-allocator, cplusplus, cpp, educational, educational-project, memory, memory-management
- Language: C++
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Arena allocator
A very simple C++ arena allocator using POSIX mmap.
It is unfit for commercial usage and should be only used for
educational purposes.## Install
```bash
sudo make install
```## Test
To run a test program, run
```bash
make test
```## Example
```c++
#includeint main (int argc, char ** argv)
{
arena::allocator Lifetime = arena::allocator::create(400);
int * Buf_1 = Lifetime.allocate(120);
int * Buf_2 = Lifetime.allocate(80);
int * Buf_3 = Lifetime.allocate(200);
// Further allocation will yield null as arena's memory is over
// Arena's memory is deallocated when it goes out of scope
}
```