only need to run garbage collector when mode != r