summaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-09-12 07:02:35 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-09-12 07:02:35 -0700
commit4edfb0c2b6a7b6e915cb6ce5083284e6502e5086 (patch)
treecb19abf19316a89fad67b842a303bd898a5fcbd1 /gc.c
parentead7c462846401cd3cb9e770b6ab1bae2fa9d7bb (diff)
downloadtxr-4edfb0c2b6a7b6e915cb6ce5083284e6502e5086.tar.gz
txr-4edfb0c2b6a7b6e915cb6ce5083284e6502e5086.tar.bz2
txr-4edfb0c2b6a7b6e915cb6ce5083284e6502e5086.zip
gc: bug in determining tight heap bounding box.
* gc.c (more): The heap_max_bound and heap_min_bound variables are initialized to null. We must update them unconditionally if they are in that state. What's happening otherwise is that heap_min_bound stays null and so we unnecessarily process false positives in the in_heap function.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 526e4a5c..1b3e68cd 100644
--- a/gc.c
+++ b/gc.c
@@ -140,10 +140,10 @@ static void more(void)
if (free_list == 0)
free_tail = &heap->block[0].t.next;
- if (end > heap_max_bound)
+ if (!heap_max_bound || end > heap_max_bound)
heap_max_bound = end;
- if (block < heap_min_bound)
+ if (!heap_min_bound || block < heap_min_bound)
heap_min_bound = block;
while (block < end) {