Getting metaspace errors, or blank pages that end up being related to this? Don’t tweak the maxmetaspace: remove it!
[Originally written Feb 2020, updated Feb 2021]
Update: Since posting this, I can announce that CF2021 does in fact no longer offer this maxmetaspace arg by default. That’s great! But if you are on CF2018 or earlier (and Java 8 or later), then the below still applies. (Also, if you migrate into 2021 the admin settings from a previous version which did set it, the arg will be brought in then, so again the below would still apply.)
Have you been annoyed to find CF failing with outofmemory errors referring to “outofmemoryerror: metaspace”, or more simply just “metaspace”. Or you may get strange cases of CF pages simply “returning blank”, and if you look into CF’s coldfusion-error.log file, you may see this metaspace error appearing then.
You may google the problem and find folks helpfully suggesting that you increase CF’s JVM argument related to this (whatever size you see):
I will suggest instead that for most folks you should simply REMOVE this argument entirely. Most folks simply don’t need this set, but Adobe sets it for us to a small default value, for reasons related to previous Java versions. You do need to be careful about that. Remove all of it, from the – to the mb. I would also recommend you remove it by editing the jvm.config rather than in the CF Admin (in case you make a mistake, and a CF restart could then fail and you’d not be able to get to the CF Admin.)
If you want to find out more on why I suggest removing it, how to do it safely, and more, see the blog post on my own site with much more information, here:
I also offer there a link to a bug report where I make the case that Adobe should also stop setting this value for us.
(Again, as an update, since I posted this, Adobe HAS removed the arg in CF2021, for new installs. It may still import any that existed in a previous CF version that was migrated in.)
Finally, I address as well the question of whether one might ever WANT to set a higher value, as well as how to MONITOR the use of metaspace, and more.