< prev index next >
test/jdk/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java
Print this page
rev 56046 : v2.00 -> v2.05 (CR5/v2.05/8-for-jdk13) patches combined into one; merge with 8229212.patch; merge with jdk-14+11; merge with 8230184.patch.
*** 1,7 ****
/*
! * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 72,90 ****
throw new RuntimeException("FAILED: RemoteException encountered");
}
}
/**
! * Force desparate garbage collection so that all WeakReference instances
* will be cleared.
*/
private static void flushRefs() {
java.util.Vector chain = new java.util.Vector();
try {
while (true) {
int[] hungry = new int[65536];
chain.addElement(hungry);
}
} catch (OutOfMemoryError e) {
}
}
}
--- 72,93 ----
throw new RuntimeException("FAILED: RemoteException encountered");
}
}
/**
! * Force desperate garbage collection so that all WeakReference instances
* will be cleared.
*/
private static void flushRefs() {
java.util.Vector chain = new java.util.Vector();
try {
while (true) {
int[] hungry = new int[65536];
chain.addElement(hungry);
}
} catch (OutOfMemoryError e) {
+ // An inflated Java monitor can keep 'obj' alive so request
+ // an explicit GC to make sure things are cleaned up.
+ System.gc();
}
}
}
< prev index next >