SWI-Prolog provides garbage-collection, last-call optimization and atom garbage collection. These features are controlled using Prolog flags (see current_prolog_flag/2).