views:

162

answers:

3

Hi all:

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.

A: 

As far as I know, you can only change them by passing those arguments to the JVM (as you did). So, what's wrong with manually checking the values passed in (or assuming default values, if you're not specifying them)?

Matt Ball
@Bears will eat you: I was thinking there might be another way, but thanks for your clarification on this approach.
Michael Mao
+2  A: 

You can use something like VisualVM, http://java.dzone.com/articles/best-kept-secret-jdk-visualvm&default=false&zid=159&browser=16&mid=0&refresh=0, to monitor your memory usage and you will see the max by where it peaks, and it will give you specific info as to which part of memory is actually full, so you can better optimize your environment.

You may find that some part of memory that you don't think about is actually filling up, and by monitoring it you can see what you need to do to get better performance.

James Black
+1 for checking using a performance tool
linuxuser27
+5  A: 

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>

Strelok