Skip to content

Latest commit

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

static-allocator

A global static stateless allocator. Header only. It is well suited for frequently allocated objects that have similar known sizes and when it is known an upper limit of the maximum amount of objects allocated at once.

Simply copy the header file and integrate it into your build system however you want. Note the license.

#include<list>
#include"allocator.hpp"using MyObject1Storage = allocator::StaticAllocatorStorage<32, 8, 4>;
using MyObject2Storage = allocator::StaticAllocatorStorage<64, 24, 8, true>;
structMyObject1 : allocator::StaticAllocated<MyObject1, MyObject1Storage> {
int a {};
int b {};
};
structMyObject2 {
int a {};
int b {};
};
intmain() {
MyObject1* obj1 = new MyObject1;
delete obj1;
std::list<MyObject2, allocator::StaticAllocator<MyObject2, MyObject2Storage>> obj2;
obj2.emplace_back();
}

About

Global static steteless memory allocator for C++

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages