1

Since recently, the metaspace memory of my tomcat application grew to unreasonable sizes, completely overcapping the maximum memory capacity of my server. I have a hunch about what is the cause of this issue, but I would like to confirm that first, so I need a way to inspect the metaspace's content. The application is running with Java 8, which I plan to upgrade in a few months.

From what I've found out during my researches, checking the metaspace of Java 8 applications is very tricky to do. I've tried software such as JMC, but they are only able to inspect the heap memory, which the metaspace isn't a part of. I've already set a maximum size for the metaspace memory usage, which fixed the issue for now. But this is only a workaround, I would like to fix what suddenly causes the metaspace to grow so quickly, as this definitely didn't happen until a few months ago.

Zazume
  • 11
  • 2
  • `jcmd VM.metaspace` Good enough? – Michael Jan 09 '23 at 18:57
  • @Michael Unfortunately no, this command was introduced in Java 11. As I said, our app is still using Java 8 for the next at least 6 months. – Zazume Jan 10 '23 at 07:29
  • 1
    What is your hunch about the cause of the issue? – Holger Jan 10 '23 at 12:03
  • @Holger Recently we have added a new feature that uses pre generated files on our VM's disk to accelerate a process. I have a hunch that meta data about these files are flooding the metaspace and are not properly garbage collected when not in use anymore. These files are not large, but there are many of them. I would like to take a look in the metaspace's content to confirm this. – Zazume Jan 11 '23 at 07:12
  • 1
    The metaspace is about class files/executable code. Your description sounds like you are talking about other kind of files. – Holger Jan 11 '23 at 10:13
  • We have "resolved" the issue by setting a maximum size for the metaspace. We also restart the tomcat every night, since this issue only appears on our development system. We will soon upgrade our Java version to Java 17, then we might be able to analyze what really is the issue. – Zazume Mar 02 '23 at 09:11

0 Answers0