--- old/test/jdk/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java 2019-08-28 15:01:01.314963609 -0400 +++ new/test/jdk/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java 2019-08-28 15:01:01.142963615 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -74,7 +74,7 @@ } /** - * Force desparate garbage collection so that all WeakReference instances + * Force desperate garbage collection so that all WeakReference instances * will be cleared. */ private static void flushRefs() { @@ -85,6 +85,9 @@ 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(); } } }