mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
OOME guard
This commit is contained in:
@@ -45,13 +45,18 @@ public abstract class WeaksTestCase extends TestCase {
|
||||
|
||||
protected static void gc() {
|
||||
System.gc();
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
while (Runtime.getRuntime().freeMemory() > 10000) {
|
||||
list.add(new byte[1000]);
|
||||
}
|
||||
try {
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
while (Runtime.getRuntime().freeMemory() > 10000) {
|
||||
list.add(new byte[1000]);
|
||||
}
|
||||
|
||||
System.gc();
|
||||
list = null;
|
||||
System.gc();
|
||||
list = null;
|
||||
}
|
||||
catch (OutOfMemoryError e) {
|
||||
// ignore
|
||||
}
|
||||
System.gc();
|
||||
|
||||
WeakReference<Object> weakReference = new WeakReference<Object>(new Object());
|
||||
|
||||
Reference in New Issue
Block a user