Retract and freeing memory


I read in the Crafts of Prolog book that not all prolog system actually free memory after retract/1 calls.

For some reason retract/1 requires backtracking over, to get memory actually freed. The book then suggests using retractall/2 instead (or build your own retractall, that backtracks over all retracts.

What is the situation with swi-prolog?

I am using for bookkeeping some some “global” facts i frequently update (retract / reallocate) in the prolog fact base. Do these all stick around internally, adding memory as i go?



See Garbage Collect Clauses