Get visual graph of heap memory usage in Java over a span of time

前端 未结 2 829
挽巷
挽巷 2021-02-06 00:48

I am currently using Visual VM to monitor the heap memory usage of my Java application. However I would like to somehow see the heap memory usage over a span of time like for ex

相关标签:
2条回答
  • 2021-02-06 01:23

    Try the Memory tab in JConsole. JConsole is also included with the Oracle JDK, like JVisualVM, so you should already have it. It has a time range of "all" which should work for what you want to do. It will look like this:

    screenshot of jconsole

    0 讨论(0)
  • 2021-02-06 01:25

    Run your Java program with the following Java options:

    -Xloggc:log.out -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
    

    and download HPjmeter to visualize log.out.

    Also see SUN's GC portal webpage for more options to run with. Since the data is written to a file, you won't have any problems collecting days or weeks worth of data. Of course, if you wish to visualize data with lots of information, you'll need to run HPjmeter with more memory.

    Your other option is to use JConsole.

    0 讨论(0)
提交回复
热议问题