Port in some fixes for processing very heaps with segments >4Gb