From 2bd585df2633aafc0aec9ddd5a502c680d1b8430 Mon Sep 17 00:00:00 2001 From: jcm Date: Wed, 11 Jan 2017 04:26:49 -0800 Subject: [PATCH] 8164293: HotSpot leaking memory in long-running requests Summary: Applied RMs in sweep_code_cache and related codes. Reviewed-by: kvn, thartmann --- src/share/vm/code/nmethod.cpp | 1 + src/share/vm/runtime/sweeper.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/share/vm/code/nmethod.cpp b/src/share/vm/code/nmethod.cpp index e20f507a6..d1cbdccb0 100644 --- a/src/share/vm/code/nmethod.cpp +++ b/src/share/vm/code/nmethod.cpp @@ -1151,6 +1151,7 @@ void nmethod::clear_inline_caches() { // Clear ICStubs of all compiled ICs void nmethod::clear_ic_stubs() { assert_locked_or_safepoint(CompiledIC_lock); + ResourceMark rm; RelocIterator iter(this); while(iter.next()) { if (iter.type() == relocInfo::virtual_call_type) { diff --git a/src/share/vm/runtime/sweeper.cpp b/src/share/vm/runtime/sweeper.cpp index b4954ff86..ba4ce2da2 100644 --- a/src/share/vm/runtime/sweeper.cpp +++ b/src/share/vm/runtime/sweeper.cpp @@ -319,6 +319,7 @@ void NMethodSweeper::possibly_sweep() { } void NMethodSweeper::sweep_code_cache() { + ResourceMark rm; Ticks sweep_start_counter = Ticks::now(); _flushed_count = 0; @@ -626,6 +627,7 @@ int NMethodSweeper::process_nmethod(nmethod *nm) { // state of the code cache if it's requested. void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) { if (PrintMethodFlushing) { + ResourceMark rm; stringStream s; // Dump code cache state into a buffer before locking the tty, // because log_state() will use locks causing lock conflicts. @@ -643,6 +645,7 @@ void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) { } if (LogCompilation && (xtty != NULL)) { + ResourceMark rm; stringStream s; // Dump code cache state into a buffer before locking the tty, // because log_state() will use locks causing lock conflicts. -- GitLab