-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemorymgr.h
27 lines (16 loc) · 1013 Bytes
/
memorymgr.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
// memorymgr.h: Public functions implemented by memorymgr.c
#ifndef MEMORYMGR_H
#define MEMORYMGR_H
//This prevent from the multiple inclusion of same header file multiple time.
void initmemory(int size); // initialize a simulated heap
void *myalloc(int length); // allocate a block of length (or more) bytes
void myfree(void *ptr); // free an allocated block
void coalesce(); // go through the heap, coalescing unallocated blocks
void printallocation(); // print info about the simulated heap, for debugging purposes
// The following functions are needed for HW6.
// You should implement them now, as they will also be useful to help you implement HW5.
int isAllocated(int *p); // is the block at location p allocated?
int *nextBlock(int *p); // return a pointer to the block that follows p
int *firstBlock(); // return a pointer to the first block on the heap
int *lastBlock(); // return a pointer to the sentinel block
#endif