set_prolog_flag(gc,off)
The garbage collector is invoked automatically to reclaim the space taken by garbage in the top-most segment when the top of the heap or the top of the stack hits the current watermark. The watermarks are reset after each garbage collection, and users have control over the values to which the watermarks are set by changing the Prolog flag gc_threshold. In general, the larger the threshold is, the more frequently garbage collection is called. The default threshold is set 100.
Users can start the garbage collector by calling the following built-in predicate:
garbage_collectand can check the number of garbage collections that have been performed since the system was started by using statistics/0 or statistics/2.