Skip to main content
Participant
February 5, 2016
Question

coldfusion 11 error java.lang.OutOfMemoryError: Metaspace

  • February 5, 2016
  • 3 replies
  • 5456 views

a few times a day I am getting this error - how do I fix it?

This topic has been closed for replies.

3 replies

Charlie Arehart
Community Expert
Community Expert
February 27, 2020

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:

 

https://www.carehart.org/blog/client/index.cfm/2020/2/24/solving_metaspace_errors/

/Charlie (troubleshooter, carehart. org)
BKBK
Community Expert
Community Expert
March 1, 2020

I agree with Charlie and have voted for his maxmetaspace bug report .

@shelley5, could you tell us what kind of application you have? What does it do?

Legend
March 2, 2020

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.

 

Regards, Carl.

Community Expert
March 26, 2018

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

Dave Watts, Eidolon LLC
Legend
February 5, 2016

Hi Shelley,

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.

HTH, Carl