From 2c43d65c7db47f2b682b8924669b8e6aef22ec0a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 14 Jan 2021 19:43:30 -0800 Subject: Made all the heap garbage collection code optional, which saves some time and memory. --- bp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bp.c') diff --git a/bp.c b/bp.c index 51d34ca..3257d0f 100644 --- a/bp.c +++ b/bp.c @@ -120,7 +120,9 @@ static int process_file(def_t *defs, const char *filename, vm_op_t *pattern, uns } recycle_if_unused(&m); +#ifdef DEBUG_HEAP check(recycle_all_matches() == 0, "Memory leak: there should no longer be any matches in use at this point."); +#endif destroy_file(&f); return success; @@ -300,7 +302,7 @@ int main(int argc, char *argv[]) } if (flags & BP_JSON) printf("]\n"); -#ifdef FREE_ON_EXIT +#ifdef DEBUG_HEAP // This code frees up all residual heap-allocated memory. Since the program // is about to exit, this step is unnecessary. However, it is useful for // tracking down memory leaks. -- cgit v1.2.3