Applies function to all the live objects in the image. Normally it is not useful to sweep objects in generation 0 because they are ephemeral, so by default
does not sweep generation 0. This can be changed by passing a non-
value as gen-0.
function should take one argument, the object. It can allocate, but if it allocates heavily the sweeping becomes unreliable. Small amounts of allocation will normally happen only in generation 0, and so will not affect sweeping of other generations.