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