From ec2e474e5c7d250ebeb9fc77d94dc5155ecc84dc Mon Sep 17 00:00:00 2001 From: vsc Date: Wed, 27 Feb 2002 02:10:01 +0000 Subject: [PATCH] don't give up if you don't have enough space to expand the consult stack. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@390 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/cdmgr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/C/cdmgr.c b/C/cdmgr.c index 71de997c9..17618cdd7 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -715,10 +715,11 @@ static void expand_consult(void) /* now double consult capacity */ ConsultCapacity += InitialConsultCapacity; /* I assume it always works ;-) */ - new_cl = (consult_obj *)AllocCodeSpace(sizeof(consult_obj)*ConsultCapacity); - if (new_cl == NULL) { - Error(SYSTEM_ERROR,TermNil,"Could not expand consult space: Heap crashed against Stacks"); - return; + while ((new_cl = (consult_obj *)AllocCodeSpace(sizeof(consult_obj)*ConsultCapacity)) == NULL) { + if (!growheap(FALSE)) { + Error(SYSTEM_ERROR,TermNil,"Could not expand consult space: Heap crashed against Stacks"); + return; + } } new_cs = new_cl + (InitialConsultCapacity+1); new_cb = new_cs + (ConsultBase-ConsultSp);