2

I am facing Metaspace OOM in JDK. There are so many SoftRefence Custom ClassLoaders live which should have been flushed before Metaspace OOM, but not sure why it is not happening?

Is there any way to flush SoftReferences in JDK8 Metaspace?

AKS
  • 1,393
  • 3
  • 19
  • 29
  • what java version are you using *exactly*? – Eugene Jun 28 '17 at 11:20
  • @Eugene JDK1.8.0.65 – AKS Jun 28 '17 at 11:23
  • @Eugene: note that `b113` refers to “beta 113”, not “update 113”. These bugs were resolved in 2013… – Holger Jun 28 '17 at 14:49
  • @Holger shoot, you are right :( thank you – Eugene Jun 28 '17 at 14:50
  • I just verified with a simple example program that soft references are cleared before the JVM runs out of metaspace. So the most plausible reason that your soft references were not cleared, is, there are other references to the same loaders. – Holger Jun 28 '17 at 17:29
  • @Holger so which JDK version does it maps to ? – AKS Jun 29 '17 at 04:42
  • 1
    Well, I tried several versions in the range between beta 132 and update 121. Unfortunately, I don’t have an earlier version (before beta 113) where the bug should be reproducible. But your version, update 65, was among the tested. But it’s a complex topic as there are several configuration options (garbage collection algorithm, limits, triggers, etc) that can affect the outcome. But still, I would check the strong references first. Keep in mind that a class loader is reachable even if just a single class defined by it is still in use. Class loaders are also reachable if there’s a child loader. – Holger Jun 29 '17 at 07:58

0 Answers0