зеркало из https://github.com/mozilla/pluotsorbet.git
Collect everything before running the test
This commit is contained in:
Родитель
d171378351
Коммит
1ad0d2f015
|
@ -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());
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче