Better than triggering a garbage collection, which GHC does when needed, and you can force it with
you may prevent the task from growing unlimitedly by capping the heap max size with
+RTS -Msize
as listed in the users guide RTS options to control the garbage collector
Check this GHC advice area for improving memory efficiency.