What are ReservedCodeCacheSize and InitialCodeCacheSize?

后端 未结 4 828
你的背包
你的背包 2020-11-29 18:56

Can someone please explain what the JVM option ReservedCodeCacheSize and InitialCodeCacheSize are? Specifically when/why would I want to change it?

4条回答
  •  情深已故
    2020-11-29 19:41

    @jeha answers everything I wanted to know from this question, apart from what value to set the parameters to. As I didn't write the code I was deploying I didn't have much visibility into the memory footprint it had.

    However, you can use jconsole to attach to your running java process, and then use the 'Memory' tab to find out the Code Cache size. For completeness, the steps are (Linux VM environment, though I'm sure other environments are similar):

    1. Fire up jconsole on your machine
    2. Find the right process ID and attach jconsole to it (this will take a few moments)
    3. Navigate to the 'Memory' tab
    4. From the 'Chart:' drop-down list, select 'Memory Pool "Code Cache"'
    5. Again, this may take a few moments for the screen to refresh, and then you should see something like: jconsole code cache image

      As you can see, my code cache is using approx 49 MB. At this point I still had the default which the documentation (and @jeha) says is 48 MB. Certainly a great motivation for me to increase the setting!

      Ben.


      1024 MB by default probably was overdoing it, but 48 MB by default seems to be underdoing it...

提交回复
热议问题