This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
There are frequent reports that when J2EE functionality is used in the IDE OutOfMemoryError is thrown reporint full permanent generation area. Some problems were already fixed (issues #55015) some other needs to be investigated.
Permanent generation is an area in java heap where the following objects are stored 1. Symbols (method names, class names, field names, signatures etc.) 2. intern'ed String objects. (refer to java.lang.String.intern method) 3. meta data (InstanceKlass, Method objects, ConstantPool, ConstantPool cache objects etc.) for java classes. Symbols are shared between multiple classes and so can not be attributed to a specific class. same can be said about intern'ed String objects.
Maybe that we really have too many classes and run out of the space even wothout any leak. I tried to start the IDE, create a J2EE project, add seesion EJB, add a method, add servlet calling this EJB, create an INSANE dump, start the app server, build the web module, browse nodes in runtime and get to the state with full perm gen. After start there were 7100 classes. after playing w/ J2EE functionality it grew to ~10000, INSANE caused resolving of many other classes and it grew to 13000 (800 unloaded) and next few operations were required to reach 13800/900 and full permgen.
We really do not fit into memory. My attempt to put all NetBeans JARs ona classpath load all classes into JVM (without resolving) failed when 17717 classes were loaded. Looking at jstat -gc and -class output classes occupies 22228.5 but permgen is full at this moment. -J-XX:MaxPermSize should help. I am not sure what should be the limit. 80MB?
Adding extra 16MB to the current 64MB of perm area is IMHO fine. But I think we should release-note that the users may run out of perm area (for example with complex ant scripts using custom tasks) and that they should increase from -XX:MaxPermSize=80m to something higher in such a case.
80MB is enough to load 19678 classes into 72873kB. Of course we need to load more classes from JDK, Ant classes for building and some other stuff (MDR generated classes, DB drivers) but it is unlikely that we will need all these during one run.
Unfortunately if I use Class.forName(name,true,cl) it loads 20058 classes and requires 84955.8kB
OK, as discussed I am going to add -J-XX:MaxPermSize=96m to ide/launcher/netbeans.conf in both trunk and release41_beta branch after QA confirms this does not prevent IDE from starting on all supported platforms/JDKs.
-J-XX:MaxPermSize=96m is now in ide/launcher/netbeans.conf in both trunk and release41_beta
Thanks. Marking as fixed, please reopen if the problems reappear.
v.