SlideShare una empresa de Scribd logo
1 de 9
METASPACE IN JAVA 8
Kesava Prasad A
Contents
 One important change in Memory Management in Java 8
 Overview of java memory regions
 What is causing it?
 Give me an example
 What is the solution?
 Miscellaneous Points
 Reference
One important change in Memory Management in Java 8
Oracle’s latest edition for Java – Java 8 was released in March 2014. As usual, tons of new features have been added.
There is one major change in the Memory management area that I want to discuss today.
“So long PermGen, Hello Metaspace !!”
Oracle has completely gotten rid of ‘PermGen’ and replaced it with Metaspace.
The key difference between PermGen and Metaspace is this:
 While PermGen is part of Java Heap (Maximum size configured by -Xmx option), Metaspace is NOT part of Heap.
 Rather Metaspace is part of Native Memory (process memory) which is only limited by the Host Operating System.
 Similar to the Oracle JRockit and IBM JVM's, the JDK 8 HotSpot JVM is now using native memory for the
representation of class metadata, which is called Metaspace.
Native Memory: Native memory is the memory which is available to a process, e.g. the Java process. Native memory is
controlled by the operating system and based on physical memory and other physical devices, example - disks, flash
memory etc.
Overview of java memory regions
Java applications are allowed to use only a limited amount of memory. The exact amount of memory your particular
application can use is specified during application startup. To make things more complex, Java memory is separated
into different regions, as seen in the following figure:
The size of all those regions, including the metaspace area, can be specified during the JVM launch. If you do not
determine the sizes yourself, platform-specific defaults will be used.
The java.lang.OutOfMemoryError: Metaspace message indicates that the Metaspace area in memory is exhausted.
What is causing it?
We are all good at java memory management and also familiar with another concept in Java memory management
called PermGen.
Starting from Java 8, the memory model in Java was significantly changed.
A new memory area called Metaspace was introduced and Permgen was removed. This change was made due to
variety of reasons, including but not limited to:
 The required size of permgen was hard to predict. It resulted in either under-provisioning
triggering java.lang.OutOfMemoryError: Permgen size errors or over-provisioning resulting in wasted resources.
 GC Performance improvements, enabling concurrent class data de-allocation without GC Puses and specific
iterators on metadata
 Support for further optimizations such as G1 concurrent class unloading.
So if you were familiar with PermGen then all you need to know as background is that – whatever was in PermGen
before Java 8 (name and fields of the class, methods of a class with the bytecode of the methods, constant pool, JIT
optimizations etc) – is now located in Metaspace.
As you can see, Metaspace size requirements depend both upon the number of classes loaded as well as the size of
such class declarations.
So it is easy to see the main cause for the java.lang.OutOfMemoryError: Metaspace is: either too many classes or too
big classes being loaded to the Metaspace.
Give me an example
Metaspace usage is strongly correlated with the number of classes loaded into the JVM. The following code serves as
the most straightforward example:
public class Metaspace {
static javassist.ClassPool cp = javassist.ClassPool.getDefault();
public static void main(String[] args) throws Exception{
for (int i = 0; ; i++) {
Class c = cp.makeClass("eu.plumbr.demo.Generated" + i).toClass();
}
}
}
 In this example the source code iterates over a loop and generates classes at the runtime.
 All those generated class definitions end up consuming Metaspace.
 Class generation complexity is taken care of by the javassist library.
 The code will keep generating new classes and loading their definitions to Metaspace until the space is fully utilized
and the java.lang.OutOfMemoryError: Metaspace is thrown.
 When launched with -XX:MaxMetaspaceSize=64m then on Mac OS X my Java 1.8.0_05 dies at around 70,000 classes
loaded.
What is the solution?
 The first solution when facing the OutOfMemoryError due to Metaspace should be obvious.
 If the application exhausts the Metaspace area in the memory you should increase the size of Metaspace.
 Alter your application launch configuration and increase the following:
-XX:MaxMetaspaceSize=512m
 The above configuration example tells the JVM that Metaspace is allowed to grow up to 512 MB before it can start
complaining in the form of OutOfMemoryError.
 Another solution is even simpler at first sight.
 You can remove the limit on Metaspace size altogether by deleting this parameter.
 But pay attention to the fact that by doing so you can introduce heavy swapping and/or reach native allocation
failures instead.
 Before calling it a night though, be warned – more often than not it can happen that by using the above
recommended “quick fixes” you end up masking the symptoms by hiding the java.lang.OutOfMemoryError:
Metaspace and not tackling the underlying problem.
 If your application leaks memory or just loads something unreasonable into Metaspace the above solution will not
actually improve anything, it will just postpone the problem.
Miscellaneous Points
 Overall if we see there is not a much difference between PermGen and Metaspace in Java8 except the new flags and
the error message that we have seen earlier.
 Only advantage now you will have more space in the heap, but on the other side we don’t have any tool with which
we can analyze this meta-data information as compared to the tools available e.g.jconsole ,HeapAnalyzer etc for
analyzing heap.
 The removal of PermGen doesn’t mean that your class loader leak issues are gone. So, yes, you will still have to
monitor your consumption and plan accordingly, since a leak would end up consuming your entire native memory
causing swapping that would only get worse.
 No Garbage Collection scan or compaction.
 Garbage collection of the dead classes and classloaders is triggered once the class metadata usage reaches the
“MaxMetaspaceSize”.
THANK YOU

Más contenido relacionado

Destacado

java memory management & gc
java memory management & gcjava memory management & gc
java memory management & gcexsuns
 
Generic Resume 9.25.16
Generic Resume 9.25.16Generic Resume 9.25.16
Generic Resume 9.25.16Rachel Page
 
Network of Electronic Self-Navigating Transports Presentation (NEST)
Network of Electronic Self-Navigating Transports Presentation (NEST)Network of Electronic Self-Navigating Transports Presentation (NEST)
Network of Electronic Self-Navigating Transports Presentation (NEST)David Wu
 
Online activism may not be enough
Online activism may not be enoughOnline activism may not be enough
Online activism may not be enoughCory Turk
 
Desensamble del teclado
Desensamble del tecladoDesensamble del teclado
Desensamble del tecladoDaniGasu
 
Xenia Alcantara | Design Portfolio
Xenia Alcantara | Design PortfolioXenia Alcantara | Design Portfolio
Xenia Alcantara | Design PortfolioXenia Alcantara
 
Jiahua PVB FILM catalogue
Jiahua PVB FILM catalogueJiahua PVB FILM catalogue
Jiahua PVB FILM catalogueSophie Sun
 
Necessity breeds innovation
Necessity breeds innovationNecessity breeds innovation
Necessity breeds innovationShannon Tiede
 

Destacado (16)

java memory management & gc
java memory management & gcjava memory management & gc
java memory management & gc
 
Popayan 2016
Popayan 2016Popayan 2016
Popayan 2016
 
Unidad de disco duro
Unidad de disco duroUnidad de disco duro
Unidad de disco duro
 
Barbara Moon
Barbara MoonBarbara Moon
Barbara Moon
 
Generic Resume 9.25.16
Generic Resume 9.25.16Generic Resume 9.25.16
Generic Resume 9.25.16
 
Network of Electronic Self-Navigating Transports Presentation (NEST)
Network of Electronic Self-Navigating Transports Presentation (NEST)Network of Electronic Self-Navigating Transports Presentation (NEST)
Network of Electronic Self-Navigating Transports Presentation (NEST)
 
SocialMedia_Bianchi
SocialMedia_BianchiSocialMedia_Bianchi
SocialMedia_Bianchi
 
Online activism may not be enough
Online activism may not be enoughOnline activism may not be enough
Online activism may not be enough
 
Desensamble del teclado
Desensamble del tecladoDesensamble del teclado
Desensamble del teclado
 
Xenia Alcantara | Design Portfolio
Xenia Alcantara | Design PortfolioXenia Alcantara | Design Portfolio
Xenia Alcantara | Design Portfolio
 
2013-annual-report
2013-annual-report2013-annual-report
2013-annual-report
 
CV di Francesco_Rosso - EN
CV di Francesco_Rosso  - ENCV di Francesco_Rosso  - EN
CV di Francesco_Rosso - EN
 
Jiahua PVB FILM catalogue
Jiahua PVB FILM catalogueJiahua PVB FILM catalogue
Jiahua PVB FILM catalogue
 
Necessity breeds innovation
Necessity breeds innovationNecessity breeds innovation
Necessity breeds innovation
 
Newst CV
Newst CVNewst CV
Newst CV
 
Aprendizaje autonomo
Aprendizaje autonomo Aprendizaje autonomo
Aprendizaje autonomo
 

Último

Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 

Último (20)

Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 

Metaspace in Java 8

  • 1. METASPACE IN JAVA 8 Kesava Prasad A
  • 2. Contents  One important change in Memory Management in Java 8  Overview of java memory regions  What is causing it?  Give me an example  What is the solution?  Miscellaneous Points  Reference
  • 3. One important change in Memory Management in Java 8 Oracle’s latest edition for Java – Java 8 was released in March 2014. As usual, tons of new features have been added. There is one major change in the Memory management area that I want to discuss today. “So long PermGen, Hello Metaspace !!” Oracle has completely gotten rid of ‘PermGen’ and replaced it with Metaspace. The key difference between PermGen and Metaspace is this:  While PermGen is part of Java Heap (Maximum size configured by -Xmx option), Metaspace is NOT part of Heap.  Rather Metaspace is part of Native Memory (process memory) which is only limited by the Host Operating System.  Similar to the Oracle JRockit and IBM JVM's, the JDK 8 HotSpot JVM is now using native memory for the representation of class metadata, which is called Metaspace. Native Memory: Native memory is the memory which is available to a process, e.g. the Java process. Native memory is controlled by the operating system and based on physical memory and other physical devices, example - disks, flash memory etc.
  • 4. Overview of java memory regions Java applications are allowed to use only a limited amount of memory. The exact amount of memory your particular application can use is specified during application startup. To make things more complex, Java memory is separated into different regions, as seen in the following figure: The size of all those regions, including the metaspace area, can be specified during the JVM launch. If you do not determine the sizes yourself, platform-specific defaults will be used. The java.lang.OutOfMemoryError: Metaspace message indicates that the Metaspace area in memory is exhausted.
  • 5. What is causing it? We are all good at java memory management and also familiar with another concept in Java memory management called PermGen. Starting from Java 8, the memory model in Java was significantly changed. A new memory area called Metaspace was introduced and Permgen was removed. This change was made due to variety of reasons, including but not limited to:  The required size of permgen was hard to predict. It resulted in either under-provisioning triggering java.lang.OutOfMemoryError: Permgen size errors or over-provisioning resulting in wasted resources.  GC Performance improvements, enabling concurrent class data de-allocation without GC Puses and specific iterators on metadata  Support for further optimizations such as G1 concurrent class unloading. So if you were familiar with PermGen then all you need to know as background is that – whatever was in PermGen before Java 8 (name and fields of the class, methods of a class with the bytecode of the methods, constant pool, JIT optimizations etc) – is now located in Metaspace. As you can see, Metaspace size requirements depend both upon the number of classes loaded as well as the size of such class declarations. So it is easy to see the main cause for the java.lang.OutOfMemoryError: Metaspace is: either too many classes or too big classes being loaded to the Metaspace.
  • 6. Give me an example Metaspace usage is strongly correlated with the number of classes loaded into the JVM. The following code serves as the most straightforward example: public class Metaspace { static javassist.ClassPool cp = javassist.ClassPool.getDefault(); public static void main(String[] args) throws Exception{ for (int i = 0; ; i++) { Class c = cp.makeClass("eu.plumbr.demo.Generated" + i).toClass(); } } }  In this example the source code iterates over a loop and generates classes at the runtime.  All those generated class definitions end up consuming Metaspace.  Class generation complexity is taken care of by the javassist library.  The code will keep generating new classes and loading their definitions to Metaspace until the space is fully utilized and the java.lang.OutOfMemoryError: Metaspace is thrown.  When launched with -XX:MaxMetaspaceSize=64m then on Mac OS X my Java 1.8.0_05 dies at around 70,000 classes loaded.
  • 7. What is the solution?  The first solution when facing the OutOfMemoryError due to Metaspace should be obvious.  If the application exhausts the Metaspace area in the memory you should increase the size of Metaspace.  Alter your application launch configuration and increase the following: -XX:MaxMetaspaceSize=512m  The above configuration example tells the JVM that Metaspace is allowed to grow up to 512 MB before it can start complaining in the form of OutOfMemoryError.  Another solution is even simpler at first sight.  You can remove the limit on Metaspace size altogether by deleting this parameter.  But pay attention to the fact that by doing so you can introduce heavy swapping and/or reach native allocation failures instead.  Before calling it a night though, be warned – more often than not it can happen that by using the above recommended “quick fixes” you end up masking the symptoms by hiding the java.lang.OutOfMemoryError: Metaspace and not tackling the underlying problem.  If your application leaks memory or just loads something unreasonable into Metaspace the above solution will not actually improve anything, it will just postpone the problem.
  • 8. Miscellaneous Points  Overall if we see there is not a much difference between PermGen and Metaspace in Java8 except the new flags and the error message that we have seen earlier.  Only advantage now you will have more space in the heap, but on the other side we don’t have any tool with which we can analyze this meta-data information as compared to the tools available e.g.jconsole ,HeapAnalyzer etc for analyzing heap.  The removal of PermGen doesn’t mean that your class loader leak issues are gone. So, yes, you will still have to monitor your consumption and plan accordingly, since a leak would end up consuming your entire native memory causing swapping that would only get worse.  No Garbage Collection scan or compaction.  Garbage collection of the dead classes and classloaders is triggered once the class metadata usage reaches the “MaxMetaspaceSize”.