1.) Introduce CompoundLimit to limit the memory usage of large compound edits, e.g. search-replace-all
2.) contentInserted() + contentRemoved() - Try to use the same string object in all Edit objects. I'm not sure if the change for contentInserted() is necessary. The change for contentRemoved() is needed. The String passed to contentRemoved() is a new String for each call in the search-and-replace-all loop, but in my simple replacement case, has always the same content.
3.) addEdit() - un-reference the old object correctly, so garbage collection can remove it, see also CompoundEdit.add()