Availability:C-language interface function
void PL_reset_term_refs(term_t 
after)Destroy all term references that have been created after after, 
including after itself. Any reference to the invalidated term 
references after this call results in undefined behaviour.
Note that returning from the foreign context to Prolog will reclaim 
all references used in the foreign context. This call is only necessary 
if references are created inside a loop that never exits back to Prolog. 
See also PL_open_foreign_frame(), PL_close_foreign_frame() 
and
PL_discard_foreign_frame().