Explaining java.lang.OutOfMemoryError: PermGen space

Most probably, a lot of Java developers have seen OutOfMemory error one time or other. However these errors come in different forms and shapes. The more common is: "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space" and indicates that the Heap utilization has exceeded the value set by -Xmx. This is not the only error message, of this type, however.
One more interesting flavor of the same error message, less common but hence even more troublesome is: "java.lang.OutOfMemoryError: PermGen space". Most of the memory profiler tools are unable to detect this problem, so it is
even more troublesome and therefor - interesting.
To understand this error message and fix it, we have to remember that, for optimized, more efficient garbage-collecting Java Heap is managed in generations - memory segments holding objects of different ages. Garbage collection algorithms in each generation are different. Objects are allocated in a generation for younger objects - the Young Generation, and because of infant mortality most objects die there. When the young generation fills up it causes a Minor Collection. Assuming high infant mortality, minor collections are garbage-collected frequently. Some surviving objects are moved to a Tenured Generation. When the Tenured Generation needs to be collected there is a Major Collection that is often much slower because it involves all live objects. Each generation contains variables of different length of life and different GC policies are applied to them.
There is a third generation too - Permanent Generation. The permanent generation is special because it holds meta-data describing user classes (classes that are not part of the Java language). Examples of such meta-data are objects describing
classes and methods and they are stored in the Permanent Generation. Applications with large code-base can quickly fill up this segment of the heap which will cause java.lang.OutOfMemoryError: PermGen no matter how high your -Xmx and how much memory you have on the machine.
Sun JVMs allow you to resize the different generations of the heap, including the permanent generation. On a Sun JVM (1.3.1 and above) you can configure the initial permanent generation size and the maximum permanent generation size.

To set a new initial size on Sun JVM use the -XX:PermSize=64m option when starting the virtual machine. To set the maximum permanent generation size use -XX:MaxPermSize=128m option. If you set the initial size and maximum size to equal values you may be able to avoid some full garbage collections that may occur if/when the permanent generation needs to be resized. The default values differ from among different versions but for Sun JVMs upper limit is typically 64MB.
Some of the default values for Sun JVMs are listed below.
JDK 1.3.1_06 Initial Size Maximum Size
Client JVM 1MB 32MB
Server JVM 1MB 64MB
JDK 1.4.1_01 Initial Size Maximum Size
Client JVM 4MB 64MB
Server JVM 4MB 64MB
JDK 1.4.2 Initial Size Maximum Size
Client JVM 4MB 64MB
Server JVM 16MB 64MB

Labels

%ROWTYPE (1) 10 principles of testing (1) 35 Powerful jQuery Plugins (1) About Jquery (1) Abstract (1) Abstract Class (1) Abstraction (1) ActiveX Controls (1) Adobe Flash (4) Adobe Flash CS5 (1) Adobe Flash Player (1) Adobe Flex (2) Adobe Flex 4 (1) Adobe Flex Builder (1) Adobe Flex Builder 3 (1) Adobe Flex Builder 4 (1) after trigger (1) Ajax (1) Amarok 2.3.0 (1) and Accenture (1) Android Mobile (1) ant property string value (1) Apache (1) Apache Portable Runtime (1) Apache Server (1) Apache Tomcat Performance Tuning (2) Apache Tomcat Server (1) Apple (1) Apple Ipad (2) Applet (2) Application (1) APR library (1) Arabic PDF Reports (1) ArrayList (4) Arrays (1) AS/400 (1) ASP.NET (5) Autodesk Maya 2009 (1) Autodesk Maya 2010 (1) Automatic Workload Repository Report (1) Autotrace in Oracle (1) ava heap space Error in JVM (1) Awk Tutorial (1) AWR Features (3) AWR Oracle 10g (3) AWR Report (3) AWR Report in Oracle (1) AWT (2) before trigger (1) Best Java Interface Example (3) Binary Large Object(BLOB) (1) BlockingDeque (1) Business Intelligence (2) calloc (1) CEBR (1) CECI transactions in CICS (1) CEDF (1) CEMT (1) Character Large Object (CLOB) (1) CICS (7) CICS in the COBOL program (2) CICS Interview MNC Questions (4) CICS Interview Questions (15) CICS Transactions (1) CICS Tutorial (4) Cisco Certification (1) Cisco Certification 642-062 test (1) Cisco IOS Multicast Virtual Private Network (MVPN) (1) ClassNotFoundExceptions (1) Closure (1) Cloud Computing (2) COBOL (3) COBOL Error Codes (1) COBOL Interview Questions (12) COBOL Mainframe Interview Questions (3) COBOL Manuals (1) Cobol Programming (1) COBOL TALLYING (1) COBOL Tutorials (3) Collections Framework Java API (7) Common Errors in Setting Java Heap Size (1) Compiler (1) connect sql server 2005 (1) Cookies (1) Core Dump inUnix (1) Core Java Interview Questions (11) Core Java Tutorial (2) Core packages in Java SE 6 (1) CPU utilisation (1) Creating AWR report (1) Creating JAR in Eclipse (1) Crystal Reports (1) Crystal Reports XI (1) CSS3 Techniques (1) CURRVAL (1) Cursors in Oracle (3) Customer Information Control System (1) Data Export using oracle (1) Data Integration (1) Database (3) Dataset (1) Datasource (1) DataSource embedded in java application (1) Dataware Housing (2) DB2 (3) DB2 Admin Interview (1) DB2 Administration (1) DB2 Administration Interview Questions (1) DB2 Certification (1) DB2 for z/OS (1) DB2 forLinux (1) DB2 Interview Questions (4) DB2 Packages (1) DB2 PROGRAMMING (1) DB2 SQL (2) DB2 Tutorials (2) DB2 UDB Admin (1) DB2 UDB Admin Interview Questions (1) DBA (1) DBMS (1) DBMS_STATS (1) DBMS_UTILITY (1) Debugging an application that is running in a CICS JVM (1) Deque (1) Developer (3) Difference between JSP and Servlets (1) Disabling Triggers (1) Displaying Trigger Errors (1) DNS services (1) DOM Parser (3) DOM Parser in JAVA (1) Downloading JQuery (1) Eclipse (3) Eclipse IDE (2) Eclipse WTP (1) EclipseCon 2010 Registration (1) EJB 3.1 spec.JNDI names for EJB (1) EJB lite (1) EJBException (1) Encapsulation (1) Enumeration (1) ETL (3) ETL Open Source (1) ETL Tools (4) Example of PL/SQL trigger in Oracle (1) Execute Immediate (1) Exhausted Resultset (1) explicit cursor (1) Export oracle report data (1) Features of Jquery (1) Fedora12 (1) Flash Player (1) FOR UPDATE (1) Forward declaration in Oracle (1) Function Overloading in Java (1) Garbage Collection in JVM (1) Gather Stats in Oracle (1) Glassfish Connection Pool setup (1) Google Android (1) grep through sub-directories (1) Groovy (2) Groovy 2.0.0 (1) HashMap (3) Hashtable (2) HAVING CLAUSE (1) Hewlett Packard (1) Hibernate (1) How to Create Login Page with ASP (1) How to Install and Configure Oracle on Linux (1) How to Install Oracle 10g on Linux (1) HP (2) HP Certification (1) HP Certification I HP0-766 Exam (1) HP Dell and IBM (3) HP Extreme (1) HP Servers (1) HP Tools (1) HTML 5 (1) HTML Basics (1) HTML Tutorials (1) HTML Using Java (1) HTML5 Canvas (1) HTTP connector (1) IBM (8) IBM 000-001 certification (1) IBM AIX (1) IBM AIX 5.3 Unix (1) IBM AIX Unix (1) IBM As400 (1) IBM Certification (1) IBM CICS Frequently Asked Interview Questions (1) IBM Datastage (2) IBM DB2 (1) IBM infosphere (1) Ibm mainframe interview questions (6) IBM Mainframe Tutorials (1) IBM Mainframes (11) IBM mainframes COBOL qsam/vsam FILE STATUS CODES (1) IBM Mainframes Computer (1) IBM Mainframes Interiew Questions (1) IBM Nanophotonic (1) IBM Tutorials (1) IBM websphere (2) IBM's Transaction Server (1) IBM- DB2 (1) IDE Jboss (1) Implicit Cursor (1) Importing Data using Oracle (1) importing file from IBM Mainframes (1) IMS (1) increase the heap size available to Eclipse (1) Informatica (3) Infosys (5) Inheritance (2) Inheritance in Java (1) Installing Jquery (1) Installing Oracle 10g on SUSE Linux (1) Installing SQL Server 2005 (1) instead of trigger (1) Interface and an Abstract class (1) interfaces (1) interpreter (1) Introduction to Jquery (1) Introduction to Mainframe (1) Ipad (1) iPhone (2) J2EE application (4) J2EE modules (1) J2EE project (1) J2EE Tutorials (3) JAAP (1) Jakarta (1) JAR Eclipse IDE (1) JAR file in Java (1) Java (18) Java 6 Collections (7) Java 6.0 New Collection APIs (1) Java Applet (1) Java applets (1) Java Application (2) Java Architecture (3) Java BDK (1) Java Bean (1) Java Bigdecimal (1) Java Certification (1) java class Inheritance (1) JAVA Classpath (2) Java Collections (8) Java Collections API Interview Questions (1) Java Collections Interview Questions (2) Java Compiler (1) Java Database Connectivity (2) Java Debug Interface (JDI) (1) Java Debug Wire Protocol (1) Java Debug Wire Protocol (JDWP) (1) Java Developer (1) Java development (6) Java DOM Tutorial (2) Java Download (6) Java EE 6 (1) Java Examples (1) Java Exceptions (5) Java Framework (6) Java Free pdf online (7) Java Garbage Collection Interview Questions (2) java heap size (1) Java Heap Space (1) Java Inheritance (1) Java Interface Definition (1) Java Interface Examples (1) JAVA Interview Questions (11) java j2ee interview questions (7) JAVA J2EE tutorial (7) Java Jobs (1) Java JVM GC (1) Java lang package interview questions (1) Java math functions (1) Java memory (1) Java Package Interview questions (1) Java Packages (1) java performance (1) Java Polymorphism (1) java programing (7) Java Programming (1) Java SE 6 (2) Java source code (1) Java Sun Certification (1) Java Sun Developer (3) Java Testing Software (1) Java Tips and Tricks (1) Java tools (1) Java Tutorial (10) Java Tutorials (8) Java Virtual Machine (6) Java Virtual Machine Debug Interface (JVMDI) (1) Java web developer (1) Java XML (1) JAVA.J2EE (1) java.lang.OutOfMemoryError (5) java.lang.reflect.InvocationtargetException (1) java.net.connectexception (2) java.rmi.RemoteException (1) java.sql.SQLException (2) Java/J2EE (2) Javascript (4) JavaScript countdown timer (1) JavaScript Form Validation (1) javascript textbox validation (1) JavaScript Tutorial (2) Javascript Validation (1) JavaScript: Dynamically Add/Remove rows in HTML table (1) javax.ejb.EJBException (1) JavaXML (1) JAXP (1) JBOSS (1) JCL (5) JCL for Unzipping the File (1) JCL Interiew Questions (3) JCL tutorials (1) JDBC (5) JDBC Bridge (2) JDBC Connectivity (4) JDBC divers for UNIX (1) JDBC Driver Models (1) JDBC Drivers (4) JDBC drivers on UNIX (1) JDBC drivers on Windows (1) JDBC Example (1) JDBC in Java (1) JDBC Interview Questions (2) JDBC Tutorial (1) JDBC-ODBC (1) JDBC-ODBC Bridge driver (1) JDK (3) JDK 1.6 (1) JMS Interview Questions (1) JMS Problem Determination (1) JNDI names in EJB 3.1 (1) jntu Btech results 2010 (1) Job Control Language (2) JPA (1) JPDA (1) Jquery (5) Jquery Advantages (1) Jquery Image Rotator (1) Jquery Loading Content (1) Jquery Plugin (1) Jquery Selector (1) Jquery Server (1) Jquery Tutorials (6) JRE (1) JRuby (1) JSP (6) JSP Directives (2) JSP Interview Questions (1) JSP Life Cycle (1) JSP Life Cycle Explanation (1) JSP methods (1) JSP Servlets (2) JSP tags (2) JSP tutorial (4) JTA (1) JTS (1) JVM (4) JVM Architecture (4) JVM Crash (2) JVM Error (1) JVM Exceptions (1) JVM exits unexpectedly (1) JVM Heap Size (5) JVM Memory (1) JVM Memory Error (2) JVM Options (1) JVM Runtime Exceptions (1) JVM Settings (1) JVM Tutorials (2) JVM Virtual Memory (1) JVM Wrapper (1) JVMDI interface (1) Jython (1) KDE Software (1) LAST_DAY (1) LEVEL (1) LEVEL in Oracle (1) life cycle of a servlet (1) Life-cycle mehtods in JSP (1) LinkedList (1) Linux (3) Linux and UNIX Mail Command (1) Linux Oracle (1) Linux Tutorial (1) ListIterator (1) LOBs (Large OBjects) (1) Login Page (1) mail in UNIX (1) Mainframe (1) Mainframe Architecture (1) mainframe computer (1) Mainframe Testing (1) Mainframe Tutorials (2) Mainframes (6) Mainframes Architecture (1) Mainframes Interview Questions (3) Mainframes tutorials (3) malloc (1) Map in java (1) Materialized views in Oracle (1) Maven (1) Memory Options (1) Method Overloading in Java (1) Method Overriding in Java (1) Microsoft (17) Microsoft .NET Installation (1) Microsoft .NET Framework (1) Microsoft Certification (1) Microsoft Office 2010 (1) Microsoft Office Beta 2010 (2) Microsoft Online Services (1) Microsoft SQL Server 2005 (5) Microsoft Surface (1) Microsoft technology (4) Microsoft VB.net (7) Microsoft Visual Studio 2010 (1) Microsoft windows (2) millisecond-resolution on windows (1) Minus in oracle (1) MSSQL 2005 -JDBC Connection (1) Multiple Inheritance (1) My SQL Server (2) MySQL (1) MySQL 5.0 (2) MySQL database with Java (1) NavigableMap (1) NavigableSet (1) Nested tables (1) NetBeans (1) NetBeans 6.5 (1) NetBeans 6.8 (1) NetBeans IDE (1) NetBeans IDE 6.9 (1) NEXTVAL (2) No available router to destination (1) Objects and Classes in Java (1) ODBC (1) OLE Controls (1) Online resources for Cloud Computing (1) OOPS (2) ORA Exceptions (1) ORA-00020 (1) ORA-00060 (1) ORA-00060: deadlock detected (1) ORA-16006 (1) ORA-28009 Error (1) Oracle (18) Oracle 10g (1) Oracle 10g AWR (3) Oracle 11g (13) Oracle Applications (2) Oracle Apps (1) Oracle ASCII Function (1) Oracle Commands for DBA (2) Oracle Cursors (1) Oracle Data Base Using Servlet (1) Oracle Data Dictionary Objects (1) Oracle Data Export (1) Oracle Data import (1) Oracle Database (5) Oracle Database 10g (3) Oracle Database Links (1) Oracle Date Functions (1) Oracle DBA (3) Oracle Deadlock (1) Oracle Dynamic SQL (1) Oracle Exceptions (3) Oracle Forms (1) Oracle Functions (6) Oracle Gather Stats (2) Oracle Installation in Linux (1) Oracle Instances (1) Oracle Interview Questions (9) Oracle Java (1) Oracle Joins (1) Oracle Large Objects with JDBC (1) Oracle LEVEL Command (1) Oracle NLS Format (1) Oracle performance (2) Oracle PL/SQL (42) Oracle Pl/SQL Collections (1) Oracle PL/SQL Data Types (1) Oracle PL/SQL Date Timestamp Functions (3) Oracle PL/SQL DateTimestamp Functions (1) Oracle PL/SQL Developer (10) Oracle PL/SQL Interview Questions (14) Oracle PL/SQL Joins (1) Oracle PL/SQL Tutorial (5) Oracle PL/SQL Tutorial.Oracle PL/SQL (5) Oracle PRAGMA (1) Oracle Procedures (11) Oracle Process (1) Oracle Pseudocolumns CURRVAL (3) Oracle RAC (2) Oracle RAC installation (1) Oracle Real Application Clusters (RAC) (1) Oracle Real Application Clusters 11g (1) Oracle Reports 11g (2) Oracle Reports 9i (1) Oracle ROWNUM (1) Oracle Schema (1) Oracle Sleep Function (1) Oracle SQL (10) Oracle SQL Queries (10) Oracle SQL SELECT (1) Oracle SQL Tutorials (10) Oracle SQLCODE Function (1) Oracle SQLERRM Function (1) Oracle Sqlplus (2) Oracle Triggers (13) oracle tutorials (7) Oracle Union (1) Oracle Union all (1) Oracle Unix (1) Oracle With Unix (1) Oracle XMLELEMENT (1) Oracle XMLELEMENT Example (1) Oracle's data dictionary (1) Oracle/PLSQL (1) Oracle/PLSQL Data Types (3) Oracle/PLSQL Tutorial (2) ORACLE_HOME Path (1) Oralce DBA (2) Oralce ORDER BY (1) Oralce PL/SQL Interview Questions (3) Oralce Pseudocolumns (1) Oralce ROWNUM (1) Oralce Tips (1) OutOfMemoryError (1) Palm (1) ParserConfigurationException (1) Parsing XML file in Java (2) Performance Testing (1) Perl DBD (1) PermGen (1) PermGen space (1) PermGen space error. (1) PHP (2) PKZIP in os/390 (1) PL Sql (1) PL/SQL Function (1) PL/SQL Function Example (1) PL/SQL Triggers in Oracle (2) Pointers in C (1) Pragma EXECPTION_INIT (1) PRAGMA EXECPTION_INITOracle (1) Principles of SOA (1) Procedure Overloading in Oracle (2) Programmer (1) Programming (1) Pseudo-conversation (1) PSP Gaming (1) RDBMS (1) RedHat Linux (2) REF CURSOR (2) Remote Debugging JBoss Apps with Eclipse (1) Remote Debugging JVM Applications (1) Remote Debugging Tomcat (1) RemoteException (1) Report Layout (1) Resolve Memory Leak Problems (1) Roseindia (1) ROW Trigger (1) ROWID (1) ROWNUM (1) ruby (1) Running Total Field in Crystal Reports (1) Samba (1) Samba Configuration (1) Samba in Linux (1) Samba Network (1) SAP BO (1) SAP Business Object (2) SAP certification (1) SAP Certification Course (1) SAP Crystal Reports (1) SAP XI Certification (1) SAP XI Certification Questions (1) SAX Parser (1) SAXParser (1) SAXParserFactory (1) Scala (2) SCJP Certifications (1) SCJP Exams (1) scripting languages (1) security (1) Segmentation fault (1) Server (1) Servlet (2) Servlet Interview Questions (1) servlets (1) Session (1) set java heap size in Apache Ant (1) set java heap size in Eclipse (1) set java heap size in JavaEE SDK (1) set java heap size in jEdit (1) set java heap size in NetBeans (1) Setting the Java classpath (1) SHOW ERRORS (1) Simple Asynchronous methods in EJB 3.1 (1) Sleep Less Than One Millisecond (1) Software Developers (1) Software Engineer (1) solaris private network (1) Spring (1) SQL ROLLUP (1) SQL Server (4) SQL Server 2005 (4) SQL Server 2005 Developer Edition (1) SQL Server 2005 Jdbc connection (1) SQL server 2008 (1) SQL Server Express (1) StackOverflow (1) Statement trigger (1) Statistics in Oracle (3) Stored Procedure (1) Stored Procedure in PL/SQL (1) stored procedures (1) Struts (1) Struts framework (1) Struts Interview Questions (2) Summary Field in Crystal Reports (1) sun (1) Sun Developer Jobs (1) Sun Microsystems (4) Sun Oracle (1) Sybase (1) Sybase on Linux (1) system event triggers (1) System.currentTimeMillis() (1) TCS (5) Technology Facts (3) Time Interval Related Functions (1) Timestamp-Related Functions (1) TO_CHAR (1) TO_DATE (1) Tomcat (1) Tomcat Connector Implementations (1) Tomcat Connectors (1) Tomcat JVM configuration (1) Tomcat Performance (1) Tomcat's servlet (1) total memory using Java Runtime (1) Trigger example (1) Trigger in Oracle PL/SQL (1) triggers (1) Tuning Garbage collection with the 1.4.2 Hotspot JVM (1) Twitter (2) Types of Triggers in Oracle (1) Ubuntu (2) Ubuntu 10.10 (1) UnicastRemoteObject (1) Union in Oracle (1) Unix (6) Unix errors (1) UNIX interview questions (1) UNIX to IBM Mainframes (1) Unix Tutorial (2) Unix Tutorials (5) UNZIP in Mainframes (1) used memory (1) user events trigger (1) Using Datetime Functions (1) uTorrent For Linux (1) Validating Parameters in Oracle Reports (2) VB.net (3) VB.NET Crystal Reports (3) VB.NET GUI (1) Vector (1) Viewing Defined Triggers (1) Views in Oracle (1) Visual Basic .NET (2) visual basic Interview Questions (1) Visual C# .NET (1) Visual Studio (1) Visual Studio 2010 Beta 2 (1) Visual Studio 2010 Express (1) VNC Server in Linux (1) VS 2005 Professional (1) VSAM (2) VSAM Interview Questions (4) VSAM Tutorials (1) Web applications (1) Web Server Plug-In Problem Determination (1) Weblogic Exceptions (1) WebLogic Server (1) weblogic.rjvm.PeerGoneException (1) WebSphere Application Server (1) WebSphere Application Server V6 (1) WebSphere Application Server V6.1 (1) Websphere Interview Questions (1) WebSphere Portal (1) WHERE CLAUSE (1) WHERE CURRENT OF (1) Why Jquery (1) Windows (4) Windows Component Services (1) Windows Mobile (1) Windows MS-DOS (1) Windows Network (1) Windows XP (1) Windows7 (1) Wipro (4) Working of Java Virtual Machine (JVM) (1) wrapped Exception (1) Wrapper Classes (1) Xbox (1) Xerces Parser (1) XML (1) XML and Java Parsing (1) XML Example (1) XML Examples (1) XML file in Java (1) XML in Java (1) XML Java (1) XML Parser (2) XML Publisher product (1) XML Tools (1) XML Tutorials (1) XML with Java (1) XMLELEMENT (1) XP Pro SP2 (1)