The Prolog data created during setting up the call and calling Prolog can in most cases be discarded right after the call. See figure for an example.
.BF .F void PL_mark 1 bktrk_buf Mark the global and trail stacks in bktrk_buf. .F void PL_bktrk 1 bktrk_buf Undo all changes in the runtime stacks since a snapshot has been made in buffer using PL_mark(). Changes to the heap are not affected. .EF
It is not necessary to call PL_bktrk() for each PL_mark(). The user should ensure that PL_bktrk() is never called with a buffer that is created after a buffer to which PL_bktrk() has been called. Thus PL_mark(b1) ... PL_mark(b2) ... PL_bktrk(b1) is valid, but it is not allowed to call PL_bktrk(b2) after this sequence.