a few times a day I am getting this error - how do I fix it?
Increase the size of MaxMetaspaceSize=192m in Java JVM settings. You can edit that in CFadmin or edit
CF\cfusion\bin\jvm.config. What size? I seen folks use 512m.
CF needs to restart for the setting change to take effect.
Carl's reply is helpful - if you're getting out-of-memory errors, increase the amount of memory!
But in the long term, it would probably help you to understand how JVM memory management works, to understand how and why to increase JVM memory. Here's a very brief and slightly oversimplified summary.
In Java 7, the heap size (which is where variables go, and is effectively all the memory you have to worry about usually) was divided into three "generations": young, tenured and permanent. The young generation is where variables were created if they weren't expected to last long. The permanent generation is where variables were stored if they were expected to last a very long time (or forever). The space in between is where variables would end up if they survived longer than expected - they would be moved from the young to the tenured generation.
Java 8 changed this, but has some similarities. What was called the "permanent generation" in Java 7 and earlier, is now "metaspace".
Now, the important thing about this memory area is, it's used to store variables that will be around for a long time, and CF can create a lot of those variables. This is especially true if you're using a CF-based CMS. In those cases, you might want to allocate more memory to this area than you otherwise would. But doing this takes away memory from the other areas, so you might also have to increase the overall heap size as well. So it's useful, if you can, to get an idea of how much stuff you have in memory and what kind of stuff it is. If you can't do that, just increase the heap size and the metaspace a little bit at a time until the errors go away.
Dave Watts, Fig Leaf Software
With all do respect to Carl and Dave, I'll offer a different solution (for those who may find this, as it comes up as among the first Google results for a search on coldfusion metaspace).
While raising the value is indeed one solution, I argue that the best solution for most folks is simply to remove the maxmetaspacesize argument. I explain more, including why Adobe sets it (a remnant of an old situation related to maxpermsize from Java 7 and earlier) here:
One other CF JVM idea folks like might to try is remove the reference to UseParallelGC there by selecting the Java 11 default for garbage collection (which is UseG1GC). Much the same thought process as deleting reference to Metaspace and selecting Java 11 default options.
As always do your own checking before and after change to know how usage is going.
Indeed a lot has changed in 4 years with the CF Java layer. Today with CF2018 using current Java 11 one could do well to remove JVM arguments referencing MetaSpace.
I still think some kind of Java logging, JMX with JMC, jconsole or Java Flight Recorder could be useful to know how well the CF Java and tomcat therefore application is going.
Thanks, guys. And Carl, I do cover the value of monitoring the use of metaspace--via logs or tools--in my post. But again, most will find there's no problem with the metaspace running wild, and it was simply getting just large enough to hit the artificial limit Adobe blithely set.
As for the GC algo, I do agree that we should question adobe's ongoing choice of parallelgc. But the level experience of using g1 with cf is still rather small.
More than that, I would argue that few have GC problems. I know it can seem that it's rampant, but really it's not. Here again, diagnostics could help one know if it's an issue worth worrying about. I'm just saying that for most it's not.
And that's all the more reason why we don't see much experience with changing the GC algo, let alone tweaking other GC args.