Showing posts with label permgen. Show all posts
Showing posts with label permgen. Show all posts

Thursday, January 9, 2014

java.lang.OutOfMemoryError: PermGen space with eclipse

By default, Eclipse comes with below PermGen configuration in eclipse.ini file.
--launcher.XXMaxPermSize
256m

But this is not working with some versions. As per eclipse bug, this is not working with Java 1.6_21, but I was facing this issue even in Java 1.6_32 as well.

Anyway,add below parameter in eclipse.ini as a vm argument to resolve the issue.
-XX:MaxPermSize=256M

Even after this, if your eclipse is crashing with PermGen space issue, then try to increase the size.
I would say 512M is a very big size for PermGen space, If some application is taking more than that means, it's a real application issue, developers need to analyze where it's taking so much of space.

Resources:
http://wiki.eclipse.org/FAQ_How_do_I_increase_the_permgen_size_available_to_Eclipse%3F
https://bugs.eclipse.org/bugs/show_bug.cgi?id=319514 

Friday, October 18, 2013

Java VM PermGen space

The Java VM memory is split up to 3 memory spaces:

  • The Java Heap. Applicable for all JVM vendors, usually split between YoungGen (nursery) & OldGen (tenured) spaces.
  • The PermGen (permanent generation). Applicable to the Sun HotSpot VM only (PermGen space will be removed in future Java 7 or Java 8 updates)
  • The Native Heap (C-Heap). Applicable for all JVM vendors.

The Java HotSpot VM permanent generation space is the JVM storage used mainly to store your Java Class objects.  The Java Heap is the primary storage that is storing the actual short and long term instances of your PermGen Class objects.

The PermGen space is fairly static by nature unless using third party tool and/or Java Reflection API which relies heavily on dynamic class loading.
It is important to note that this memory storage is applicable only for a Java HotSpot VM; other JVM vendors such as IBM and Oracle JRockit do not have such fixed and configurable PermGen storage and are using other techniques to manage the non Java Heap memory (native memory).

Below diagram showcases various heap memories and how we can configure them using vm arguments.




JVM: Permgen is a non-heap


In Oracle's JVM, the permanent generation is not part of the heap. It's a separate space for class definitions and related data. In Java 6 and earlier, interned strings were also stored in the permanent generation. In Java 7, interned strings are stored in the main object heap.


From above link, we can understand these terms:

Eden Space (heap): The pool from which memory is initially allocated for most objects.

Survivor Space (heap): The pool containing objects that have survived the garbage collection of the Eden space.

Tenured Generation (heap): The pool containing objects that have existed for some time in the survivor space.

Permanent Generation (non-heap): The pool containing all the reflective data of the virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas.

Code Cache (non-heap): The HotSpot Java VM also includes a code cache, containing memory that is used for compilation and storage of native code.