Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Suppressing the generation of DelegatingClassLoader

923493Dec 11 2012 — edited Dec 13 2012
We have question regarding DelegatingClassLoader which is apparently causing the OutOfMemoryError: PermGen space with our system.

While analyzing a heap dump using Yourkit we have observed many instances of DelegatingClassLoader created through reflection by frameworks used for our web application.
It is allegedly used for some sort of reflection optimization mechanism according to the url at http://www-01.ibm.com/support/docview.wss?uid=swg21566549.
Becuase this is what seems to be eating up our memory allocated for PermGen, as the number of the DelegatingClassLoader is gradually increased and JVM crushes with OutOfMemoryError,
we have tried setting sun.reflect.inflationThreshold = 0 as suggested thereby. However it does not seem to be working as we are still seeing DelegatingClassLoaders getting generated.
We also scrutinized the following source code corresponds to where this property is set and its value is retrieved.

http://javasourcecode.org/html/open-source/jdk/jdk-6u23/sun/reflect/ReflectionFactory.java.html

and

http://javasourcecode.org/html/open-source/jdk/jdk-6u23/sun/reflect/NativeMethodAccessorImpl.java.html

Looks to me that specifying 0 will not have any effect on suppressing the generation of the DelegatingClassLoaders. The value apparently needs to something very big and it has to be

something like Integer.MAX_VALUE in order to turn that feature off forever.

My question is, why there are a lot of mentioning about setting this property value to 0 and whether setting a large number such as Integer.MAX_VALUE is safe, if that is what needs to be done.

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2013
Added on Dec 11 2012
13 comments
3,801 views