Commit a250ff9f authored by Son Pham's avatar Son Pham

Edit makefile

parent dd6616b8
......@@ -45,5 +45,5 @@ best-fit-test: $(SRC)/best-fit-test.c $(OBJ)/allocator.o $(OBJ)/dnode.o $(OBJ)/d
.PHONY: clean
clean:
/bin/rm -rf $(BIN)/* $(OBJ)/* $(DOC)/* core* *~
/bin/rm -rf $(BIN)/* $(OBJ)/* core* *~
......@@ -35,5 +35,5 @@ extra-credit-test: $(SRC)/extra-credit-test.c $(OBJ)/allocator.o $(OBJ)/dnode.o
.PHONY: clean
clean:
/bin/rm -rf $(BIN)/* $(OBJ)/* $(DOC)/* core* *~
/bin/rm -rf $(BIN)/* $(OBJ)/* core* *~
/**
* Name: Son Pham
* Class: CSCI 315
* Prof: Luiz Felipe Perrone
* memory-test.c
*/
#include <stdlib.h>
#include <stdio.h>
#include "dnode.h"
#include "dlist.h"
#include "allocator.h"
int print_both_list();
/**
* Main program that test the functionality of allocator
*/
int main() {
printf("\n");
printf("Initialize a memory of size 1000\n");
policy = FIRST_FIT;
allocator_init(1000);
print_both_list();
printf("\n");
printf("Allocate Memory 1: 500 bytes\n");
void* mem1 = allocate(500);
print_both_list();
printf("\n");
printf("Allocate Memory 2: 400 bytes\n");
void* mem2 = allocate(400);
print_both_list();
printf("\n");
= allocate(100);
print_both_list();
printf("\n");
printf("Deallocate memory 1\n");
deallocate(mem1);
print_both_list();
printf("\n");
printf("Deallocate memory 2\n");
deallocate(mem2);
print_both_list();
printf("\n");
printf("Deallocate memory 3:\n");
deallocate(mem3);
print_both_list();
printf("\n");
}
int print_both_list() {
printf("Free List: ");
dlist_print(free_list);
printf("Allocate List: ");
dlist_print(allocate_list);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment