Collect everything before running the test

This commit is contained in:
Marco Castelluccio 2015-07-30 22:57:24 +02:00
Родитель d171378351
Коммит 1ad0d2f015
1 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -8,10 +8,20 @@ public class TestRuntime implements Testlet {
public int getExpectedFail() { return 0; }
public int getExpectedKnownFail() { return 0; }
void collectAll() {
long freeMemory;
long endFreeMemory;
do {
freeMemory = Runtime.getRuntime().freeMemory();
Runtime.getRuntime().gc();
endFreeMemory = Runtime.getRuntime().freeMemory();
} while (endFreeMemory > freeMemory);
}
public void test(TestHarness th) {
System.out.println("freeMemory0: " + Runtime.getRuntime().freeMemory());
Runtime.getRuntime().gc();
collectAll();
long totalMemory = Runtime.getRuntime().totalMemory();
long freeMemory = Runtime.getRuntime().freeMemory();
@ -32,7 +42,7 @@ public class TestRuntime implements Testlet {
array = null;
Runtime.getRuntime().gc();
collectAll();
System.out.println("freeMemory3: " + Runtime.getRuntime().freeMemory());