RFR 8151486 : Class.forName causes memory leak

David Holmes david.holmes at oracle.com
Wed Oct 5 21:26:18 UTC 2016


On 6/10/2016 6:19 AM, Mandy Chung wrote:
>
>> 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.

What then is intended to keep PD alive? Or do we not need to keep them 
alive?

I have always assumed that domains was used to keep the PD alive for as 
long as the classloader is alive.

Thanks,
David
-----


> 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 hotspot-dev mailing list