cleanup(n) sets the cleanup period to its integer argument n and returns the former value of the cleanup period. cleanup with no arguments just returns the current cleanup period. The cleanup period is the number of loop iterations which must occur before temporary data is cleared. The default value is 10. Increasing the cleanup period causes loops to execute faster at the expense of more memory usage. If you have large amounts of temporary data and run out of memory during loop execution, try cleanup(0).