-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAllocator.h
More file actions
41 lines (30 loc) · 841 Bytes
/
Allocator.h
File metadata and controls
41 lines (30 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include "VMAllocator.h"
#include <iostream>
#include <stdint.h>
struct ALLOC_PATTERN_FIRST_FIT {};
struct ALLOC_PATTERN_BEST_FIT {};
struct ALLOC_BUFFER_STATIC {};
struct ALLOC_BUFFER_STATIC_PREALLOC {};
struct ALLOC_BUFFER_VMDYNAMIC {};
enum BYTE_PREFIX {
KB = 1024,
MB = 1024*1024,
GB = 1024*1024*1024
};
class Allocator {
public:
Allocator();
~Allocator();
// allocate
virtual void* Alloc(size_t sz, size_t alignment) =0;
// deallocate
virtual void Free(void*&) =0;
// reset allocator state
virtual void Reset() =0;
// override memory region with zeroes
virtual void ZeroMem() =0;
// release (if exists) the buffer allocated from the OS at the initialiation of the allocator.
virtual void Release() = 0;
virtual void Layout() =0;
};