gc_margin(Units) can be set, using set_blob_type/2.
PL_BLOB_* flags of the type, present only if set. See
section
12.4.10.1.1. 0,
the default for every type, leaves Type to agc_margin,
which counts atoms regardless of what they keep alive. Setting
agc_margin to zero
disables atom garbage collection and no type budget overrides that. See section
12.4.10.3.gc_margin(Units) to see how
far behind collection is.gc_margin(Units) on top of this,
which is what stops a type whose blobs are live from asking repeatedly.gc_margin(Units) can be set; see blob_type_property/2.
A type normally declares its budget in C when it defines its PL_blob_t
(see section
12.4.10.3); this predicate tunes a running system.The clause garbage collector (CGC) scans the environment stacks of all threads for referenced dirty predicates and at which generation this reference accesses the predicate. It then removes the references for clauses that have been retracted before the oldest access generation from the clause list as well as the secondary clauses indexes of the predicate. If the clause list is not being scanned, the clause references and ultimately the clause itself is reclaimed.
The clause garbage collector is called under three conditions, (1) after reloading a source file, (2) if the memory occupied by retracted but not yet reclaimed clauses exceeds 12.5% of the program store, or (3) if skipping dead clauses in the clause lists becomes too costly. The cost of clause garbage collection is proportional with the total size of the local stack of all threads (the scanning phase) and the number of clauses in all ‘dirty’ predicates (the reclaiming phase).
true. Values for
Status are true, false and stop.
The latter stops the gc thread but allows is to be
recreated lazily. This is use by e.g., fork/1
to avoid forking a multi-threaded application. See also gc_thread.
loop :-
generator,
trim_stacks,
potentially_expensive_operation,
stop_condition, !.
The Prolog top-level loop is written this way, reclaiming memory resources after every user query. See also trim_heap/0 and thread_idle/2.
local, global or trail.
The table below describes the Key(Value) pairs.
Current settings can be retrieved with prolog_stack_property/2.
Related hooks are message_hook/3 (redefining GC messages), prolog_trace_interception/4 and prolog_exception_hook/5.
The total space limit for all stacks is controlled using the prolog flag stack_limit.