Is it possible to get the object reference count?

前端 未结 2 701
甜味超标
甜味超标 2020-12-03 06:44

I\'d like to know if there is a way to check how many references a Java object has. As far as I could check the only way to do that is using JVMTI through a JNI interface. I

2条回答
  •  误落风尘
    2020-12-03 07:15

    Java doesn't offer this option natively as far as I know.

    Here you have some guidance on how to do it manually:

    http://www.velocityreviews.com/forums/t363649-how-do-i-get-a-reference-count-of-a-object-in-java.html

提交回复
热议问题