8279949: JavaThread::_free_handle_block leaks native memory
Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
394ce5f948
commit
1aff44b2cf
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -384,10 +384,15 @@ void JNIHandleBlock::release_block(JNIHandleBlock* block, JavaThread* thread) {
|
||||
block->_next = freelist;
|
||||
}
|
||||
block = NULL;
|
||||
}
|
||||
if (block != NULL) {
|
||||
Atomic::dec(&_blocks_allocated);
|
||||
delete block;
|
||||
} else {
|
||||
DEBUG_ONLY(block->set_pop_frame_link(NULL));
|
||||
while (block != NULL) {
|
||||
JNIHandleBlock* next = block->_next;
|
||||
Atomic::dec(&_blocks_allocated);
|
||||
assert(block->pop_frame_link() == NULL, "pop_frame_link should be NULL");
|
||||
delete block;
|
||||
block = next;
|
||||
}
|
||||
}
|
||||
if (pop_frame_link != NULL) {
|
||||
// As a sanity check we release blocks pointed to by the pop_frame_link.
|
||||
|
Loading…
Reference in New Issue
Block a user