8273902: Memory leak in OopStorage due to bug in OopHandle::release()

Reviewed-by: sspitsyn, coleenp
This commit is contained in:
Volker Simonis 2021-09-16 19:56:12 +00:00
parent 9c5441c9c4
commit bc48a0ac29
2 changed files with 2 additions and 4 deletions
src/hotspot/share

@ -48,7 +48,7 @@ inline OopHandle::OopHandle(OopStorage* storage, oop obj) :
}
inline void OopHandle::release(OopStorage* storage) {
if (peek() != NULL) {
if (_obj != NULL) {
// Clear the OopHandle first
NativeAccess<>::oop_store(_obj, (oop)NULL);
storage->release(_obj);

@ -206,9 +206,7 @@ JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location)
}
JvmtiBreakpoint::~JvmtiBreakpoint() {
if (_class_holder.peek() != NULL) {
_class_holder.release(JvmtiExport::jvmti_oop_storage());
}
_class_holder.release(JvmtiExport::jvmti_oop_storage());
}
void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) {