File f = generateAlignment();
f.deleteOnExit();
+ long expectedMin = 35L;
+ long usedMemoryAtStart=getUsedMemory();
+ if (usedMemoryAtStart>expectedMin)
+ {
+ System.err.println("used memory before test is "+usedMemoryAtStart+" > "+expectedMin+"MB .. adjusting minimum.");
+ expectedMin = usedMemoryAtStart;
+ }
doStuffInJalview(f);
Desktop.instance.closeAll_actionPerformed(null);
- checkUsedMemory(35L);
+ checkUsedMemory(expectedMin);
}
+ private static long getUsedMemory()
+ {
+ long availableMemory = Runtime.getRuntime().totalMemory() / ONE_MB;
+ long freeMemory = Runtime.getRuntime().freeMemory() / ONE_MB;
+ long usedMemory = availableMemory - freeMemory;
+ return usedMemory;
+ }
/**
* Requests garbage collection and then checks whether remaining memory in use
* is less than the expected value (in Megabytes)
/*
* check used memory is 'reasonably low'
*/
- long availableMemory = Runtime.getRuntime().totalMemory() / ONE_MB;
- long freeMemory = Runtime.getRuntime().freeMemory() / ONE_MB;
- long usedMemory = availableMemory - freeMemory;
-
+ long usedMemory = getUsedMemory();
/*
* sanity check - fails if any frame was added after
* closeAll_actionPerformed