From 1f402478f49d24a1a7a72650258cd77a89213b1f Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Mon, 27 Dec 2021 23:09:29 +0100 Subject: Last edits --- mm.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mm.c b/mm.c index 1237441..c5361f7 100644 --- a/mm.c +++ b/mm.c @@ -139,15 +139,18 @@ * * I didn't implement mm_checkheap. It was more convinient for me to implement * separate functions for printing and checking integrity of the heap and data - * structures. All those functions are run only if the DEBUG flags is defined, - * otherwise their body is empty. I also used sanitzer. What I checked in those - * debug functions: + * structures. All those functions are run only if the DASSERT flags is defined. + * There is debug ouput only if both DASSERT and DEBUG flags are defined. + * I also used sanitzer. What I checked in those debug functions: * * - Integrity of the heap, i.e. check if there are no adjacent free blocks, * check if prevfree bits are set correctly, check if last block is actually * the last block, check if last block ends with the heap. * - Integrity of the free block list, if the size in both boundary tags are - * equal, if none of them has the prevfree block set + * equal, if none of them has the prevfree block set etc. + * + * There are also many assert in other functions. They also serve as a hint + * about assumptions the function has (e.g. argument points to a free block). */ #include @@ -589,6 +592,8 @@ static free_block_t *find_fit(size_t reqsz) { return root; } +/* --=[ Debug functions ]=-------------------------------------------------- */ + #ifdef DASSERT static void print_splay(node_t *node, int ind) { if (is_sentiel(node)) -- cgit v1.2.3