call gc if we set dead mega clauses.
This commit is contained in:
parent
5b443bdc46
commit
c3eb3db4ed
11
C/cdmgr.c
11
C/cdmgr.c
@ -2654,6 +2654,7 @@ p_purge_clauses( USES_REGS1 )
|
|||||||
PredEntry *pred;
|
PredEntry *pred;
|
||||||
Term t = Deref(ARG1);
|
Term t = Deref(ARG1);
|
||||||
Term mod = Deref(ARG2);
|
Term mod = Deref(ARG2);
|
||||||
|
MegaClause *before = DeadMegaClauses;
|
||||||
|
|
||||||
Yap_PutValue(AtomAbol, MkAtomTerm(AtomNil));
|
Yap_PutValue(AtomAbol, MkAtomTerm(AtomNil));
|
||||||
if (IsVarTerm(t))
|
if (IsVarTerm(t))
|
||||||
@ -2677,7 +2678,15 @@ p_purge_clauses( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
purge_clauses(pred);
|
purge_clauses(pred);
|
||||||
UNLOCKPE(34,pred);
|
UNLOCKPE(34,pred);
|
||||||
return (TRUE);
|
/* try to use the garbage collector to recover the mega clause,
|
||||||
|
in case the objs pointing to it are dead themselves */
|
||||||
|
if (DeadMegaClauses != before) {
|
||||||
|
if (!Yap_gc(2, ENV, gc_P(P,CP))) {
|
||||||
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
Reference in New Issue
Block a user