RFR 8151486 : Class.forName causes memory leak
Mandy Chung
mandy.chung at oracle.com
Wed Oct 5 20:19:32 UTC 2016
> On Oct 5, 2016, at 12:38 PM, Brent Christian <brent.christian at oracle.com> wrote:
>
> Hi,
>
> Please review my fix for 8151486, "Class.forName causes memory leak".
>
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8151486
> Webrev:
> http://cr.openjdk.java.net/~bchristi/8151486/webrev.00/
>
Since domains is not used and not intended to keep PD alive and VM maintains its own cache of these initiating PD for performance, removing domains field looks good to me.
Nit in the new test: a few long lines. Good to have line breaks.
64 ClassLoader classLoader = new URLClassLoader(new URL[]{jarFilePath.toFile().toURI().toURL()}) {
You can call Path.toUri().toURL()
78 Path testClassesDir = FileSystems.getDefault().getPath(
You can replace this with Paths.get(…)
Otherwise looks good.
Mandy
More information about the core-libs-dev
mailing list