From ffd0e1e47a7e148b427c9d8228a15090405c5ad6 Mon Sep 17 00:00:00 2001 From: Zain K Aamer Date: Tue, 24 Sep 2024 14:32:06 -0400 Subject: [PATCH] [CN-Exec] Add `free_all` for bump allocator --- runtime/libcn/include/cn-executable/alloc.h | 1 + runtime/libcn/src/alloc.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/runtime/libcn/include/cn-executable/alloc.h b/runtime/libcn/include/cn-executable/alloc.h index a6f80cb38..04b25c7a6 100644 --- a/runtime/libcn/include/cn-executable/alloc.h +++ b/runtime/libcn/include/cn-executable/alloc.h @@ -21,6 +21,7 @@ void *alloc_(long nbytes, const char *, int); #define alloc(x)\ alloc_(x, __FILE__, __LINE__) +void free_all(void); // void *alloc_zeros(long nbytes); diff --git a/runtime/libcn/src/alloc.c b/runtime/libcn/src/alloc.c index bb2389d8f..674e6d450 100644 --- a/runtime/libcn/src/alloc.c +++ b/runtime/libcn/src/alloc.c @@ -53,6 +53,9 @@ void *alloc_(long nbytes, const char *str, int line) { //return malloc(nbytes); } +void free_all(void) { + curr = buf; +} // void *alloc_zeros(long nbytes) { // void *res = alloc(nbytes);