changeset 49747:376792a6e9da

8201265: Native memory leak in ClassLoader::add_to_exploded_build_list Summary: Allocate from temporary thread local memory instead of C heap memory. Reviewed-by: coleenp, dholmes, lfoltan
author hseigel
date Wed, 11 Apr 2018 10:05:02 -0400
parents b17256b5c047
children 6a880e576856
files src/hotspot/share/classfile/classLoader.cpp
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/classLoader.cpp	Wed Apr 11 13:52:23 2018 +0200
+++ b/src/hotspot/share/classfile/classLoader.cpp	Wed Apr 11 10:05:02 2018 -0400
@@ -797,7 +797,6 @@
       struct stat st;
       if (os::stat(path, &st) == 0) {
         // File or directory found
-        Thread* THREAD = Thread::current();
         ClassPathEntry* new_entry = create_class_path_entry(path, &st, false, false, CHECK);
         // If the path specification is valid, enter it into this module's list
         if (new_entry != NULL) {
@@ -867,7 +866,6 @@
       struct stat st;
       if (os::stat(path, &st) == 0) {
         // Directory found
-        Thread* THREAD = Thread::current();
         ClassPathEntry* new_entry = create_class_path_entry(path, &st, false, false, CHECK);
 
         // Check for a jimage
@@ -912,7 +910,7 @@
   const char file_sep = os::file_separator()[0];
   // 10 represents the length of "modules" + 2 file separators + \0
   size_t len = strlen(home) + strlen(module_name) + 10;
-  char *path = NEW_C_HEAP_ARRAY(char, len, mtModule);
+  char *path = NEW_RESOURCE_ARRAY(char, len);
   jio_snprintf(path, len, "%s%cmodules%c%s", home, file_sep, file_sep, module_name);
 
   struct stat st;
@@ -934,7 +932,6 @@
       log_info(class, load)("path: %s", path);
     }
   }
-  FREE_C_HEAP_ARRAY(char, path);
 }
 
 ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const struct stat* st,