aboutsummaryrefslogtreecommitdiff
path: root/bp.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-14 19:43:30 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-14 19:43:30 -0800
commit2c43d65c7db47f2b682b8924669b8e6aef22ec0a (patch)
tree54eef343d568fa5272b9114fab2d40c197076ae8 /bp.c
parent3cd61e3abc79a80d38afa9c633c59585aeb0311a (diff)
Made all the heap garbage collection code optional, which saves some
time and memory.
Diffstat (limited to 'bp.c')
-rw-r--r--bp.c4
1 files changed, 3 insertions, 1 deletions
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.