Search code examples
javajvmjvm-crash

Java : how to check current Perm / PermGen Size?


Yesterday when I was running the WebLogic Application Server 11g installer, I encountered a OutOfMemory error, so I Googled for the answer:

java -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m -jar wls1032_generic.jar

Everything worked :)

However, when I think twice about the solution, I might have made a mistake: How could I know the current settings of those? I certainly need to check their values before overriding them, right?

Any thoughts?

Related link: People in another thread on SO suggested trial and error approach, which is not ideal.

Many thanks in advance.


Solution

  • You can check the values of any JVM flags of a running JVM by using the jinfo.exe utility.

    %JAVA_HOME%\bin\jinfo.exe -flag <flagName> <pid>

    so to check the value of -XX:PermSize JVM option you can run

    %JAVA_HOME%\bin\jinfo.exe -flag PermSize <pid>