Cleaning up is nothing more than a reference to organising and flushing buffers from previous frames. If you will, AE pushes out any data it does not need. However, often AE will try to retain some frames in memory so it doesn't need to load or calculate them again e.g. for motion blur and otehr operations. Temporal efects that work across multiple frames will intensify this tendency. This will also to some extend be true for normal keyframe data or e.g. random seed settings for wiggles and particle systems which need to be consistent across time. Furthermore deeply nested projects will cause longer cleanup because the lookup goes deeper and the rendering process needs to obbey a certain order that is more or less set in stone. All this reorganisation may take time - because AE cannot dump everything in one bold stroke and is limited by the amount of available RAM, it needs to "think" about those matters carefully which in turn may give the impression of something fishy going on.