Subject: [SWIPL] memory management when calling from C

From: Brad Simmons <[email-masked]>
Date: Mon, 23 Jul 2001 16:57:39 -0400 (EDT)

Hello.

I am currently calling prolog from C.

-------------------------------------------------------------
term_t MSS, t_2, NMs, Error, line_no;	
int i, i1;
i = 0;
i1 = 0;

while(i < 100)
{
	MSS = PL_new_term_refs(5);
	t_2 = MSS+1;		 
	NMs = MSS+2;
	Error = MSS+3;
	line_no = MSS+4;
	....

	i1 = PL_call_predicate(NULL, PL_Q_NORMAL, RE_pred, MSS);
	i++;

}
----------------------------------------------------------------

what is the effect on prolog's memory management.
What happens to the data that was previously refered to by MSS?
Does the data no longer refered to in C stay on the prolog stack?

Any help would be great.

If the non-referenced data persists - how would I remove it while using
the term_t NMs that is solved for in the query?

PS - please cc any response to->  [email-masked]

Thanks.