51 bool operator==(Chunk
const& c)
const;
66 Kalloc(
int node_,
int align_=64,
size_t blocksize_=2*1024*1024,
bool checking=
124 std::ostream&
print(std::ostream& out)
const;
148 mutable std::mutex mutex;
155 std::vector<std::vector<Chunk>> freeChunks;
160 std::vector<size_t> nLentRanges;
161 std::map<void*,size_t> systemBlocks;
163 void* extract(
int bucket);
164 void insert(
void* range,
int bucket);
165 size_t bucketsize(
int bucket)
const;
166 int bucket(
size_t n)
const;
168 size_t freeRangedMemory()
const;
170 template <
class Iter>
171 void merge(Iter first, Iter last);
172 void distribute(
void* mem,
size_t n);
173 std::pair<void*,size_t> findFreePage(
int b);
175 size_t totalAllocations, globalAllocations, freedLocal, freedGlobal, bucketMiss;
178 std::map<void*,size_t> lent;
196 KallocUnlocked(
int node_,
int align_=64,
size_t blocksize_=2*1024*1024,
bool checking=
true):
Kalloc(node_,align_,blocksize_,checking) {}
A simple memory manager for NUMA systems.
void * allocUnlocked(size_t n)
Allocates n bytes of memory.
void free(void *p, size_t n)
Releases memory range.
Kalloc(Kalloc &&kalloc)
Move Constructor.
void reserve(size_t n, size_t k)
Tells the allocator that subsequently several blocks of the same size will be requested.
size_t alignment() const
Reports the alignment size.
std::ostream & print(std::ostream &out) const
Prints memory management statistics to the given stream.
void freeUnlocked(void *p, size_t n)
Releases memory range.
void * alloc(size_t n)
Allocates n bytes of memory.
Kalloc(int node_, int align_=64, size_t blocksize_=2 *1024 *1024, bool checking=true)
Constructor.
A class for local memory management.
void * alloc(size_t n)
Allocates n bytes of memory.
KallocUnlocked(int node_, int align_=64, size_t blocksize_=2 *1024 *1024, bool checking=true)
Constructor.
void free(void *p, size_t n)
Releases memory range.