Java four types of references include strong references, soft references, weak references, and virtual references.Strong references:The garbage collector will never recycle as long as the reference existsObject obj = new Object ();
The
Today interviewed a company's Java development intern, was asked a question: How to deal with the memory leaks in Java, to ensure that the Java Virtual Machine memory will not be blown out, then actually feel that the interviewer's problem is a bit
strong, soft, weak, and virtual references to objectsin previous versions of JDK 1.2, if an object was not referenced by any variable, the program could no longer use the object. That is, only the object is in the accessible (reachable) state before
C + + arrays, pointers, references, and composite types of three There is no separate introduction to these three, only the combination types that use these three components are introduced.One, 22 combinationThere are 9 types of 22 combinations of
In Java strong reference, soft reference, weak reference and Virtual Reference original link: http://aaronfu.net /? P = 9995
Since jdk1.2, the object reference is divided into four levels, so that the program can control the object lifecycle more
Four types of references in JavaToday, look at the code, there is a class java.lang.ref.SoftReference the younger brother to God, imagine, touch Java has been 3 years, wow, even lang package below the class are not understand, how to mix. Later
Knowing the concepts of weak references and soft references are different from how they are used, and referencing classes play an important role in the process of garbage collection. We all know that the garbage collector reclaims the memory of
1, first lead me to meet a problem (I think first write the question, so the impression deeper engraved a bit):Android Java layer when calling local JNI code, will maintain a local reference table (maximum length is 512), general JNI function call
strong, soft, weak, and virtual references to objectsIn previous versions of JDK 1.2, if an object was not referenced by any variable, the program could no longer use the object. In other words, only the object is in a reachable state and the
Reprint please the head source link and the tail two-dimensional code together reprint, this article from countercurrent fish yuiop:http://blog.csdn.net/hejjunlin/article/details/52637333Background: Received a public contribution, "Reference from
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.