My Oracle Support Banner

How to Avoid the Generation of sun.reflect.GeneratedMethodAccessor Classes (Doc ID 1669883.1)

Last updated on NOVEMBER 06, 2018

Applies to:

Java SE JDK and JRE - Version 1.5.0 to 7 [Release 1.5 to 7]
Information in this document applies to any platform.

Symptoms

Your application is making heavy use of the Reflection API.  Each time, when it comes to garbage collection events (Full GC), you notice that for the Permanent Generation (PermGen) portion of the Java heap a lot of messages such as those that follow are seen:

If the PermGen is sized too small, the behaviour may result in frequent Full GC events or even in an OutOfMemoryError due to running out of PermGen space. So, these classes may be perceived as a PermGen memory leak.

The question is can the generation of classes such as 'sun.reflect.GeneratedMethodAccessor' and 'sun.reflect.GeneratedConstructorAccessor' be avoided so that they don't fill the PermGen periodically?

Please note:
This document does not directly apply to Java SE 8 or above, as the PermGen Java heap was removed.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.