openjdk-11/ZGC-reuse-entries-of-ResolvedMethodTable.patch
2020-10-24 21:52:44 +08:00

36 lines
1.4 KiB
Diff

diff --git a/src/hotspot/share/gc/z/zHeap.cpp b/src/hotspot/share/gc/z/zHeap.cpp
index 62f97d2..e950acf 100644
--- a/src/hotspot/share/gc/z/zHeap.cpp
+++ b/src/hotspot/share/gc/z/zHeap.cpp
@@ -49,6 +49,7 @@
#include "runtime/thread.hpp"
#include "utilities/align.hpp"
#include "utilities/debug.hpp"
+#include "prims/resolvedMethodTable.hpp"
static const ZStatSampler ZSamplerHeapUsedBeforeMark("Memory", "Heap Used Before Mark", ZStatUnitBytes);
static const ZStatSampler ZSamplerHeapUsedAfterMark("Memory", "Heap Used After Mark", ZStatUnitBytes);
@@ -334,6 +335,10 @@ bool ZHeap::mark_end() {
Universe::verify();
}
+ // Free unsed entries of ResolvedMethodTable and weakhandles
+ // avoid ResolvedMethodTable inflation and native memory leak
+ ResolvedMethodTable::unlink();
+
return true;
}
diff --git a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java
index a8aff47..afadfd6 100644
--- a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java
+++ b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java
@@ -75,6 +75,7 @@ public class MemberNameLeak {
test("-XX:+UseG1GC");
test("-XX:+UseParallelGC");
test("-XX:+UseSerialGC");
+ test("-XX:+UseZGC");
if (!Compiler.isGraalEnabled()) { // Graal does not support CMS and Shenandoah
test("-XX:+UseConcMarkSweepGC");
if (GC.Shenandoah.isSupported()) {