3

I've an application running without any flags setting its max heap size i.e. I'm using the VM defaults. I'd like to know what they are and I'm wondering if theres any jsomething command that would return to me my stats for max heap size. I've already tried profiling and jstat, but these tools only show me how much I'm currently using. I'd like to know what's my current MAX heap size.

eduardohl
  • 1,176
  • 2
  • 10
  • 23
  • this is a little general , any code so far ? – Caffeinated Nov 20 '14 at 16:44
  • It's a web application running in jetty, I don't want to get this value using code, I want to fire a command that would return me my current max heap size. Visual VM, Eclipse MAT, none give me that info... – eduardohl Nov 20 '14 at 16:45
  • 1
    possible duplicate of [how to get the min and max heap size settings of a JVM from within a Java program](http://stackoverflow.com/questions/2253976/how-to-get-the-min-and-max-heap-size-settings-of-a-jvm-from-within-a-java-progra) – jgr208 Nov 20 '14 at 16:45
  • No, I don't want to do that from within the application. – eduardohl Nov 20 '14 at 16:46
  • http://stackoverflow.com/questions/9152241/find-the-max-allocated-heap-size-during-the-execution-using-vm-command-line – jgr208 Nov 20 '14 at 16:46
  • You can also get it using code and print it out and it will be printed out to a log file – jgr208 Nov 20 '14 at 16:47
  • Can't bring the application down, it's in prod. – eduardohl Nov 20 '14 at 16:48
  • http://en.wikipedia.org/wiki/List_of_performance_analysis_tools use a profiling tool then or the built in java profiler – jgr208 Nov 20 '14 at 16:49

2 Answers2

1

I've managed to solve it using jconsole:

jconsole hostname:port (usually 1099)

jmx has to be active to use it.

Go to VMSummary section and look for Maximum heap size.

eduardohl
  • 1,176
  • 2
  • 10
  • 23
1
# To get the pid of the java process you want to check    
jps 

# Gives you all the info on the process. Look for -XX:MaxHeapSize=
jinfo <pid>
Pulkit Sethi
  • 2,301
  • 1
  • 12
  • 7