Add some "invisible(gc())" commands to collect memory.