Skip to content

Commit bc48a0a

Browse files
committedSep 16, 2021
8273902: Memory leak in OopStorage due to bug in OopHandle::release()
Reviewed-by: sspitsyn, coleenp
1 parent 9c5441c commit bc48a0a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed
 

‎src/hotspot/share/oops/oopHandle.inline.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ inline OopHandle::OopHandle(OopStorage* storage, oop obj) :
4848
}
4949

5050
inline void OopHandle::release(OopStorage* storage) {
51-
if (peek() != NULL) {
51+
if (_obj != NULL) {
5252
// Clear the OopHandle first
5353
NativeAccess<>::oop_store(_obj, (oop)NULL);
5454
storage->release(_obj);

‎src/hotspot/share/prims/jvmtiImpl.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location)
206206
}
207207

208208
JvmtiBreakpoint::~JvmtiBreakpoint() {
209-
if (_class_holder.peek() != NULL) {
210-
_class_holder.release(JvmtiExport::jvmti_oop_storage());
211-
}
209+
_class_holder.release(JvmtiExport::jvmti_oop_storage());
212210
}
213211

214212
void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) {

0 commit comments

Comments
 (0)
Please sign in to comment.