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
Strong references, soft references, weak references, virtual referencesLet's talk about the garbage collection mechanism gabagecollection:GC is the meaning of garbage collection (gabagecollection). Like Java, the Android system is also powered by GC
The so-called memory leak, is actually the object in the time of the recovery is not properly recycled, the memory of these wild pointers. So it's important to understand these kinds of citation patterns and use it with the Great God's blog.Reprint:
1. Strong citation (Strongreference)Strong references are the most commonly used references. If an object has a strong reference, the garbage collector will never recycle it. As follows:Object o=New object (); // Strong ReferencesWhen there is
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
Using Java how long has not known the original Java has four types of reference, this reference type and we do not normally say the same. The reference type here does not refer to one of the data types, but refers to the four types that are part of
1. Strong citation (Strongreference)Strong references are the most commonly used references. If an object has a strong reference, the garbage collector will never recycle it. As follows:Object o=New object (); // Strong ReferencesWhen there is
Presumably many friends of Oom (outofmemory) This error is not unfamiliar, and when encountered this error how to effectively solve the problem? Today we are going to say how to use soft references and weak references to effectively resolve oom
In versions earlier than JDK, when an object is not referenced by any variable, the program will no longer be able to use this object. That is to say, the program can use the object only when it is reachable. This is like in daily life, after buying
Understanding weak references in Java
Not long ago, I interviewed some candidates for senior Java development engineers. I often interview them and say, "Can you introduce me to some weak references in Java ?", If the subject says, "Well, is it
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.