</script><metaname="aes-config"content="pid=xux-opensource&user_type=101&uid=&username=&dim10=arthas"><scriptsrc="//g.alicdn.com/alilog/mlog/aplus_v2.js"id="beacon-aplus"exparams="clog=o&aplus&sidx=aplusSidx&ckx=aplusCkx"></script><scriptsrc="//g.alicdn.com/aes/??tracker/1.0.34/index.js,tracker-plugin-pv/2.4.5/index.js,tracker-plugin-event/1.2.5/index.js,tracker-plugin-jserror/1.0.13/index.js,tracker-plugin-api/1.1.14/index.js,tracker-plugin-perf/1.1.8/index.js,tracker-plugin-eventTiming/1.0.4/index.js"></script><title>vmtool | arthas</title><metaname="description"content="arthas user document">
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div></div></div><divclass="custom-container tip"><pclass="custom-container-title">TIP</p><p>Through the <code>--limit</code> parameter, you can limit the number of return values to avoid pressure on the JVM when obtaining large data. The default value of limit is 10.</p></div><h2id="specify-classloader-name"tabindex="-1"><aclass="header-anchor"href="#specify-classloader-name"aria-hidden="true">#</a> Specify classloader name</h2><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>vmtool <spanclass="token parameter variable">--action</span> getInstances <spanclass="token parameter variable">--classLoaderClass</span> org.springframework.boot.loader.LaunchedURLClassLoader <spanclass="token parameter variable">--className</span> org.springframework.context.ApplicationContext
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><h2id="specify-classloader-hash"tabindex="-1"><aclass="header-anchor"href="#specify-classloader-hash"aria-hidden="true">#</a> Specify classloader hash</h2><p>The classloader that loads the class can be found through the <code>sc</code> command.</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>$ sc <spanclass="token parameter variable">-d</span> org.springframework.context.ApplicationContext
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div><divclass="line-number"></div></div></div><p>Then use the <code>-c</code>/<code>--classloader</code> parameter to specify:</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>vmtool <spanclass="token parameter variable">--action</span> getInstances <spanclass="token parameter variable">-c</span> 19469ea2 <spanclass="token parameter variable">--className</span> org.springframework.context.ApplicationContext
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><h2id="specify-the-number-of-expanded-layers-of-returned-results"tabindex="-1"><aclass="header-anchor"href="#specify-the-number-of-expanded-layers-of-returned-results"aria-hidden="true">#</a> Specify the number of expanded layers of returned results</h2><divclass="custom-container tip"><pclass="custom-container-title">TIP</p><p>The return result of the <code>getInstances</code> action is bound to the <code>instances</code> variable, which is an array.</p><p>The expansion level of the result can be specified by the <code>-x</code>/<code>--expand</code> parameter, the default value is 1.</p></div><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>vmtool <spanclass="token parameter variable">--action</span> getInstances <spanclass="token parameter variable">-c</span> 19469ea2 <spanclass="token parameter variable">--className</span> org.springframework.context.ApplicationContext <spanclass="token parameter variable">-x</span><spanclass="token number">2</span>
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><h2id="execute-expression"tabindex="-1"><aclass="header-anchor"href="#execute-expression"aria-hidden="true">#</a> Execute expression</h2><divclass="custom-container tip"><pclass="custom-container-title">TIP</p><p>The return result of the <code>getInstances</code> action is bound to the <code>instances</code> variable, which is an array. The specified expression can be executed through the <code>--express</code> parameter.</p></div><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>vmtool <spanclass="token parameter variable">--action</span> getInstances <spanclass="token parameter variable">--classLoaderClass</span> org.springframework.boot.loader.LaunchedURLClassLoader <spanclass="token parameter variable">--className</span> org.springframework.context.ApplicationContext --express<spanclass="token string">'instances[0].getBeanDefinitionNames()'</span>
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><h2id="force-gc"tabindex="-1"><aclass="header-anchor"href="#force-gc"aria-hidden="true">#</a> Force GC</h2><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>vmtool <spanclass="token parameter variable">--action</span> forceGc
</code></pre><divclass="line-numbers"aria-hidden="true"><divclass="line-number"></div></div></div><ul><li>Use the <ahref="/en/doc/vmoption.html"class=""><code>vmoption</code></a> command to dynamically turn on the <code>PrintGC</code> option.</li></ul><h2id="interrupt-指定线程"tabindex="-1"><aclass="header-anchor"href="#interrupt-指定线程"aria-hidden="true">#</a> interrupt 指定线程</h2><p>The thread id is specified by the <code>-t</code> parameter. It can be obtained using the <code>thread</code> command.</p><divclass="language-bash ext-sh line-numbers-mode"><preclass="language-bash"><code>vmtool <spanclass="token parameter variable">--action</span> interruptThread <spanclass="token parameter variable">-t</span><spanclass="token number">1</span>