From 49b3f4e7b6b2d5fa0b7c25217583d880d8007804 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Mon, 27 Jun 2011 22:55:30 +0100 Subject: [PATCH] fix case where we just clean a single atom, the last one. --- C/grow.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/C/grow.c b/C/grow.c index 72a34cb89..957c12a36 100755 --- a/C/grow.c +++ b/C/grow.c @@ -1393,7 +1393,8 @@ Yap_growheap(int fix_code, UInt in_size, void *cip) Yap_atom_gc( PASS_REGS1 ); /* check if we have a significant improvement from agc */ if (n > NOfAtoms+ NOfAtoms/10 || - NOfAtoms > 2*AtomHashTableSize) { + /* +1 = make sure we didn't lose the current atom */ + NOfAtoms+1 > 2*AtomHashTableSize) { res = growatomtable( PASS_REGS1 ); } else { LOCK(LOCAL_SignalLock); @@ -1405,7 +1406,8 @@ Yap_growheap(int fix_code, UInt in_size, void *cip) return TRUE; } LeaveGrowMode(GrowHeapMode); - return res; + if (res) + return res; } res=do_growheap(fix_code, in_size, (struct intermediates *)cip, NULL, NULL, NULL PASS_REGS); LeaveGrowMode(GrowHeapMode);