Explore Java Lang.ref package — transfer

< H2 id = "major1" > overview

Java. Lang.ref is a special package in the Java class library. It provides reference classes closely related to the Java garbage collector. These reference class objects can point to other objects, but they are different from general references because their existence does not prevent the Java garbage collector from recycling the objects they point to. The advantage is that the messenger can keep the reference to the used object, and the JVM can still recycle the used object when the memory is not enough. Therefore, this package is particularly useful when used to implement cache related applications. At the same time, the package also provides a mechanism to remind when the "accessibility" of objects changes. This paper introduces and analyzes the package from simple to deep, so that readers can deepen their understanding of the package, so as to make better use of the package for development.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>