运行程序的时候,希望看到jvm堆内存的信息,有2种方法,
一种是使用静态的,找到程序的进程id即pid,然后使用jmap -heap pid 就可以看到了。
第二种使用动态的,使用工具jconsole或者jvisualvm。
这里介绍一下工具jvisualvm,它更加强大。
首先输入命令
D:\idea\code\firstdemo\target\classes\com\jd\qsm\first\demo\controller>jvisualvm
D:\idea\code\firstdemo\target\classes\com\jd\qsm\first\demo\controller>
The launcher has determined that the parent process has a console and will reuse it for its own console output.
Closing the console will result in termination of the running program.
Use '--console suppress' to suppress console output.
Use '--console new' to create a separate console window.
就会弹出工具jvisualvm