wavelength 1.0.0
Loading...
Searching...
No Matches
ChunkAllocator.h
Go to the documentation of this file.
1#pragma once
2
4#include "utl/PrnStream.h"
5
7const int MAX_FIXED_ALLOCS = 128;
8
16public:
23
32 void *Alloc(int size, int unused);
33
41 void Free(void *mem, int size);
42
49 void Print(PrnStream &stream);
50
51private:
59 static int SizeToIndex(int size);
60
68 static int IndexToSizeWords(int index);
69
71};
const int MAX_FIXED_ALLOCS
Size classes the chunk allocator serves, 16 bytes apart.
Definition ChunkAllocator.h:7
void Print(PrnStream &stream)
Print the use of every size class.
ChunkAllocator()
Create an allocator with no size class in use.
void Free(void *mem, int size)
Free an allocation of a size class.
void * Alloc(int size, int unused)
Allocate from the size class of a size, creating the class's allocator on first use.
Allocator of small blocks, with a FreeStore for each multiple of 16 bytes up to 2048.
Definition fixedsizealloc.h:12
Text output stream.
Definition prnstream.h:16