-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMemoryManager.h
37 lines (34 loc) · 911 Bytes
/
MemoryManager.h
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
//
// Created by Connor on 2/22/2019.
//
#ifndef UNTITLED_MEMORYMANAGER_H
#define UNTITLED_MEMORYMANAGER_H
#include <functional>
#include "bitmap.h"
#include "ProcessList.h"
#include "AllocationAlgorithms.h"
class MemoryManager {
private:
unsigned size;
std::function<int(int, void *)> defaultAllocator;
BitMap *bitmap;
ProcessList *memoryList;
char* memBlock;
bool active;
public:
MemoryManager(unsigned wordSize, std::function<int(int, void *)> allocator);
~MemoryManager();
void initialize(size_t sizeInWords);
void shutdown();
void *allocate(size_t sizeInBytes);
void free(void *address);
void setAllocator(std::function<int(int, void *)> allocator);
int dumpMemoryMap(char *filename);
void *getList();
void *getBitmap();
unsigned getWordSize();
void *getMemoryStart();
unsigned getMemoryLimit();
int holeCount();
};
#endif