aboutsummaryrefslogtreecommitdiff
path: root/malloclab-handout/util
diff options
context:
space:
mode:
Diffstat (limited to 'malloclab-handout/util')
-rw-r--r--malloclab-handout/util/mm-implicit.h (renamed from malloclab-handout/util/mm-naive-free.h)8
1 files changed, 7 insertions, 1 deletions
diff --git a/malloclab-handout/util/mm-naive-free.h b/malloclab-handout/util/mm-implicit.h
index 3aa06bd..74e0f86 100644
--- a/malloclab-handout/util/mm-naive-free.h
+++ b/malloclab-handout/util/mm-implicit.h
@@ -87,9 +87,15 @@ void print_list()
if (p >= (size_t)mem_heap_hi())
break;
- logger("{} ", offset(p));
+ logger("{}({},{}) ", offset(p), is_alloc(*(size_t*)p) ? "alloc" : "free", get_size(*(size_t*)p));
p += get_size(*(size_t*)p);
}
loggerln("");
#endif
+}
+
+void sync_footer(size_t header)
+{
+ size_t footer = header + get_size(*(size_t*)header) - SIZE_T_SIZE;
+ *(size_t*)footer = *(size_t*)header;
} \ No newline at end of file