Skip to content


8296347: Memory leak from ClassPathDirEntry::_dir
Browse files Browse the repository at this point in the history
Co-authored-by: Justin King <>
Reviewed-by: dholmes, ccheung
  • Loading branch information
Man Cao and jcking committed Nov 8, 2022
1 parent 671f84b commit 8146e1a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/hotspot/share/classfile/classLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ const char* ClassPathEntry::copy_path(const char* path) {
return copy;

ClassPathDirEntry::~ClassPathDirEntry() {
FREE_C_HEAP_ARRAY(char, _dir);

ClassFileStream* ClassPathDirEntry::open_stream(JavaThread* current, const char* name) {
// construct full path name
assert((_dir != NULL) && (name != NULL), "sanity");
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/classLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ClassPathDirEntry: public ClassPathEntry {
ClassPathDirEntry(const char* dir) {
_dir = copy_path(dir);
virtual ~ClassPathDirEntry() {}
virtual ~ClassPathDirEntry();
ClassFileStream* open_stream(JavaThread* current, const char* name);

Expand Down

1 comment on commit 8146e1a

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.