1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Attempt to fix occasional test-failure.

This commit is contained in:
Markus Schorn 2010-06-18 07:56:41 +00:00
parent 7ed4f94f50
commit 0664dab5c6

View file

@ -5912,9 +5912,16 @@ public class AST2Tests extends AST2BaseTest {
}
private long memoryUsed() throws InterruptedException {
System.gc();Thread.sleep(200);System.gc();
final Runtime runtime = Runtime.getRuntime();
return runtime.totalMemory()-runtime.freeMemory();
long mem= runtime.totalMemory()-runtime.freeMemory();
long newMem= mem;
do {
Thread.sleep(50);
System.gc();
mem= newMem;
newMem= runtime.totalMemory()-runtime.freeMemory();
} while (newMem < mem);
return mem;
}
// int n= 0;