6651256: jstack: DeleteGlobalRef method call doesn't lead to descreasing of global refs count shown by jstack
Jni_DeleteGlobalRef does not really release the jni handle, instead, set the handle point to JNIHandles::_deleted_handle which holds an oop instance (java/lang/Object) in Java heap and never be GC'ed. When counting number of global reference, it counts all the handles on the chain list, which includes the already deleted ones. Reviewed-by: zgu, sla, coleenp
This commit is contained in:
parent
dd35520229
commit
4a3aa3a77a
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -195,8 +195,10 @@ private:
|
|||||||
int _count;
|
int _count;
|
||||||
public:
|
public:
|
||||||
CountHandleClosure(): _count(0) {}
|
CountHandleClosure(): _count(0) {}
|
||||||
virtual void do_oop(oop* unused) {
|
virtual void do_oop(oop* ooph) {
|
||||||
_count++;
|
if (*ooph != JNIHandles::deleted_handle()) {
|
||||||
|
_count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
virtual void do_oop(narrowOop* unused) { ShouldNotReachHere(); }
|
virtual void do_oop(narrowOop* unused) { ShouldNotReachHere(); }
|
||||||
int count() { return _count; }
|
int count() { return _count; }
|
||||||
|
Loading…
Reference in New Issue
Block a user