Did you know ... | Search Documentation: |
![]() | Update view |
SWI-Prolog adheres to the logical update view, where backtrackable predicates that enter the definition of a predicate will not see any changes (either caused by assert/1 or retract/1) to the predicate. This view is the ISO standard. Logical updates are realised by keeping generation information on clauses. Each change to the database causes an increment of the generation of the database. Each goal is tagged with the generation in which it was started. Each clause is flagged with the generation it was created in as well as the generation it was erased. Only clauses with a‘created’ ...‘erased’interval that encloses the generation of the current goal are considered visible. The generation mechanism is also used to implement transactions See section 4.14.1.3.
Erased clauses are (eventually) reclaimed by the clause garbage
collector implemented by garbage_collect_clauses/0.
By default, the clause garbage collector runs in a thread named gc
,
together with the atom garbage collector (garbage_collect_atoms/0).
See also the Prolog flag gc_thread.