Class CompareResultWithMemoryOverflow

All Implemented Interfaces:
CompareResult, ResultCollector

public class CompareResultWithMemoryOverflow extends AbstractCompareResultWithSwap
This CompareResult monitors the memory the JVM consumes through Runtime.totalMemory() - Runtime.freeMemory() when a new page is added. When the consumed memory crosses a threshold, images are swapped to disk and removed from memory. The threshold defaults to 70% of Runtime.maxMemory() but at least 200MB, which worked for me. After swapping, a System.gc() is triggered.
  • Constructor Details

    • CompareResultWithMemoryOverflow

      public CompareResultWithMemoryOverflow()
      Defaults to 70% of the available maxMemory reported by the JVM.
    • CompareResultWithMemoryOverflow

      public CompareResultWithMemoryOverflow(long approximateMaxMemoryUsageInMegaBytes)
      Stores images to disk, when the used memory is higher than the given theshold in megabytes.
      Parameters:
      approximateMaxMemoryUsageInMegaBytes - the maximum memory to use in megabytes
  • Method Details