Skip to content

Commit

Permalink
8284620: CodeBuffer may leak _overflow_arena
Browse files Browse the repository at this point in the history
Reviewed-by: phh
Backport-of: 4d45c3ebc493bb2c85dab84b97840c8ba093ab1f
  • Loading branch information
zhengyu123 committed May 24, 2022
1 parent db52470 commit eb5711b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hotspot/src/share/vm/asm/codeBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ CodeBuffer::~CodeBuffer() {
// Previous incarnations of this buffer are held live, so that internal
// addresses constructed before expansions will not be confused.
cb->free_blob();
// free any overflow storage
delete _overflow_arena;
}

// free any overflow storage
delete _overflow_arena;

// Claim is that stack allocation ensures resources are cleaned up.
// This is resource clean up, let's hope that all were properly copied out.
Expand Down Expand Up @@ -937,6 +937,7 @@ void CodeBuffer::take_over_code_from(CodeBuffer* cb) {
this_sect->take_over_code_from(cb_sect);
}
_overflow_arena = cb->_overflow_arena;
cb->_overflow_arena = NULL;
// Make sure the old cb won't try to use it or free it.
DEBUG_ONLY(cb->_blob = (BufferBlob*)badAddress);
}
Expand Down

1 comment on commit eb5711b

@openjdk-notifier
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.