Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Java.lang.OutOfMemoryError: PermGen space

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 194
    Comment on it

    If you are facing following exception while running your code:

    Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
    

    Default size of most of JVM Perm Space is around 64MB, it can easily ran out of memory if you have too many classes or huge number of Strings in your application. Even it doesn't depends on Xmx value so no matter how big your total heap size you can ran OutOfMemory in perm space.

    Hence in order to fix this you can specify size of permanent generation using JVM options "-XX:PermSize" and "-XX:MaxPermSize" based on your project need.

    For example,

    -Xms128m -Xmx512m -XX:MaxPermSize=512m
    

    The settings start the Java virtual machine with a minimum heap memory of 128M, a max heap size of 512M and a max perm gen size of 512M.

    You can set this in Computer Environment Variable as shown in below image:

    alt text

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: