mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 04:24:49 +02:00
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 changed files with 5 additions and 3 deletions
|
@ -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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -195,9 +195,11 @@ private:
|
|||
int _count;
|
||||
public:
|
||||
CountHandleClosure(): _count(0) {}
|
||||
virtual void do_oop(oop* unused) {
|
||||
virtual void do_oop(oop* ooph) {
|
||||
if (*ooph != JNIHandles::deleted_handle()) {
|
||||
_count++;
|
||||
}
|
||||
}
|
||||
virtual void do_oop(narrowOop* unused) { ShouldNotReachHere(); }
|
||||
int count() { return _count; }
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue