/*
* maximum retained heap usage (in MB) for a passing test
*/
- private static int MAX_RESIDUAL_HEAP = 38;
+ private static int MAX_RESIDUAL_HEAP = 45;
/**
* Configure (read-only) Jalview property settings for test
long freeMemory = Runtime.getRuntime().freeMemory();
long usedMemory = availableMemory - freeMemory;
- return (int) (usedMemory/ ONE_MB);
+ return (int) (usedMemory / ONE_MB);
}
/**
* NB there is no guarantee when, or whether, it will do so
*/
long usedMemory = 0L;
+ Long minUsedMemory = null;
int gcCount = 0;
while (gcCount < 3)
{
System.gc();
waitFor(1500);
usedMemory = getUsedMemory();
+ if (minUsedMemory == null || usedMemory < minUsedMemory)
+ {
+ minUsedMemory = usedMemory;
+ }
if (usedMemory < expectedMax)
{
break;
* - take a heap dump and identify large objects in the heap and their referers
* - fix code as necessary to null the references on close
*/
- System.out
- .println("Used memory after " + gcCount + " call(s) to gc() = "
- + usedMemory + "MB (should be <=" + expectedMax + ")");
+ System.out.println("(Minimum) Used memory after " + gcCount
+ + " call(s) to gc() = " + minUsedMemory + "MB (should be <="
+ + expectedMax + ")");
assertTrue(usedMemory <= expectedMax, String.format(
"Used memory %d should be less than %d (Recommend running test manually to verify)",
usedMemory, expectedMax));