- The state of sys->variables was not maintained correctly, because

terms were destroyed before it could be tested whether they were in
  sys->variables. Thus, garbage was left in sys->variables. This has
  gone undetected because it was never really used. Hmpf.
This commit is contained in:
ccremers 2005-10-08 19:53:10 +00:00
parent ea5bc6893f
commit a3b009f119

View File

@ -991,6 +991,34 @@ roleInstanceDestroy (const System sys)
roledefDestroy (myrun.start); roledefDestroy (myrun.start);
// Destroy artefacts // Destroy artefacts
//
// sys->variables might contain locals from the run: remove them
{
Termlist tl;
tl = sys->variables;
while (tl != NULL)
{
Term t;
t = tl->term;
if (realTermLeaf (t) && TermRunid (t) == runid)
{
Termlist tlnext;
tlnext = tl->next;
// remove from list; return pointer to head
sys->variables = termlistDelTerm (tl);
tl = tlnext;
}
else
{
// proceed
tl = tl->next;
}
}
}
/* /*
* Arachne does real-time reduction of memory, POR does not * Arachne does real-time reduction of memory, POR does not
* Artefact removal can only be done if knowledge sets are empty, as with Arachne * Artefact removal can only be done if knowledge sets are empty, as with Arachne
@ -1026,30 +1054,6 @@ roleInstanceDestroy (const System sys)
} }
termlistDelete (myrun.substitutions); termlistDelete (myrun.substitutions);
// sys->variables might contain locals from the run: remove them
{
Termlist tl;
tl = sys->variables;
while (tl != NULL)
{
Term t;
t = tl->term;
if (realTermLeaf (t) && TermRunid (t) == runid)
{
// remove from list; return pointer to head
sys->variables = termlistDelTerm (tl);
tl = sys->variables;
}
else
{
// proceed
tl = tl->next;
}
}
}
// remove lists // remove lists
termlistDelete (myrun.artefacts); termlistDelete (myrun.artefacts);
termlistDelete (myrun.locals); termlistDelete (myrun.locals);