CSC-4730 / P4 / xv6 / heap.c
heap.c
Raw
//Modified for Carthage CSC_4730 P4 | Caleb Collar & Kai Kuebler
//Heap Test

#include "types.h"
#include "user.h"

#define	HEAP_GULP	(1 << 14)

int main(int argc, char ** argv) {
	void * p;
	int counter = 0;
	printf(1, "Address of a stack variable: 0x%x\n", &counter);
	printf(1, "Starting descent into heap space\n");
	while ((p = malloc(HEAP_GULP)) != 0) {
		printf(1, "Iteration: %d - %d bytes added to heap - 0x%x\n", ++counter, HEAP_GULP, p);
	}
	exit();
}