aboutsummaryrefslogblamecommitdiff
path: root/8.8/main.c
blob: f4ef71e600786c9aa3fb8f165beff1adf5ed580e (plain) (tree)























                                                             
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "malloc.h"

int main(void)
{
	char *s;

	/* size of header is 16 bytes so the mem space should
	 * be atleast 16 * 2 = 32 bytes to call bfree */
	s = malloc(32);
	bfree(s, 32);
	s = my_malloc(11);

	strcpy(s, "just werks");
	printf("%s\n", s);

	/* ||-16:HEADER-||||-16:FREE-|| */
	my_free(s);
	free(s - 16);

	return 0;
}