#include "ece250.h"

int main() {
	// this allocation is not tracked
	int * x = new int[33];

        ece250::allocation_table.start_recording();
	// these are all tracked
	int * a = new int(3);
	int * b = new int[100];
	int * c = new int[1000];
        ece250::allocation_table.summary();
	delete a;
        ece250::allocation_table.summary();
	delete [] b;
        ece250::allocation_table.summary();
	delete [] c;
        ece250::allocation_table.summary();
        ece250::allocation_table.details();

	// Failure 1
	// int * z1 = new int[100];
	// delete z1;      // Wrong delete, use delete[]

	// Failure 2
	// int * z2 = new int[100];
	// delete [] z2;
	// delete [] z2;   // Deleting same memory location twice

	// Failure 3
	// int * z3 = (int *) 0xFFFFFFFF;  // random address
	// delete [] z3;   // deleting memory not allocated

        return 0;
}