From 1c55195c050d26f7c3ef53ed8f4ff25f398cfa1e Mon Sep 17 00:00:00 2001
Date: Thu, 19 Oct 2023 11:24:12 +0800
Subject: [PATCH 2/5] Fix the memory leak of MetaspaceAllocationTest

---
 hotspot/src/share/vm/memory/metaspace.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index 0569500c1..847af1ce9 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -5712,6 +5712,8 @@ public:
     for (int i = 0; i < NUM_PARALLEL_METASPACES; i ++) {
       if (_spaces[i].space != NULL) {
         delete _spaces[i].space;
+      }
+      if (_spaces[i].lock != NULL) {
         delete _spaces[i].lock;
       }
     }
-- 
2.19.1

