zoukankan      html  css  js  c++  java
  • Java.WeakReference-SoftReference-PhantomReference

    Weak Reference, Soft Reference, Phantom Reference

    1. Introduction

    "Weak reference objects, which do not prevent their referents from being made finalizable,

    finalized, and then reclaimed. Weak references are most often used to implement canonicalizing

    mappings." Ref[1]

    弱引用对象(Weak reference objects), 该对象不会阻止 它们所引用的对象(their referents) 变为可完结的,已完结的,

    接下来可以被回收的。弱引用通常被用来实现规范化的映射。

    2. Weak reference Vs. Soft reference 

    "Weak references are useful for mappings that should have their entries removed automatically

    once they are not referenced any more (from outside). The difference between a SoftReference 

    and a WeakReference is the point of time at which the decision is made to clear and enqueue the reference:

    • SoftReference should be cleared and enqueued as late as possible, that is, in case the VM is in danger of running out of memory.
    • WeakReference may be cleared and enqueued as soon as is known to be weakly-referenced." Ref[2]

    弱引用对映射(mapping)很有用处,对于映射来讲,当它们的条目一旦不再被引用时就应该自动地从该映射中移除。

    软引用和弱引用地区别是:决定进行清理和将引用入队的时间点。


    Reference

    1. WeakReference [已读]

    http://docs.oracle.com/javase/7/docs/api/java/lang/ref/WeakReference.html

    2. WeakReference [已读]

    http://developer.android.com/reference/java/lang/ref/WeakReference.html

    3. Java Weak Reference [已读]

    http://javapapers.com/core-java/java-weak-reference/

    该blog描述了以下四种Reference类型:

    Strong Reference

    Weak Reference

    Soft Reference

    Phantom Reference

    javapapers.com: java相关的各种文章,质量不错。

    4. Understanding Weak Reference [Todo]

    https://weblogs.java.net/blog/2006/05/04/understanding-weak-references

    5. Difference between WeakReference vs SoftReference vs PhantomReference vs Strong reference in Java [Todo]

    http://www.javacodegeeks.com/2014/03/difference-between-weakreference-vs-softreference-vs-phantomreference-vs-strong-reference-in-java.html

    6. Java References: From Strong to Soft to Weak to Phantom

    https://www.rallydev.com/community/engineering/java-references-strong-soft-weak-phantom

    7. Finally understanding how references work in Android and Java (AAAA)

    https://medium.com/google-developer-experts/finally-understanding-how-references-work-in-android-and-java-26a0d9c92f83#.o2aa3dc6g

    8. Java.InnerClass 

    ---
  • 相关阅读:
    【学习笔记】pip3 安装使用国内源
    【学习笔记】Team Explorer for Microsoft Visual Studio2015 安装时发生严重错误
    微信聊天记录长图 打印
    Go语言中用 os/exec 执行命令的五种姿势
    Python 代码调试神器:PySnooper
    终于来了!!Pyston v2.0 发布,解决 Python 慢速的救星
    超详细讲解如何使用 pdb 在服务器上调试代码
    超详细图文教你如何使用 PyCharm 进行远程调试
    最全的 pip 使用指南,50 % 你可能都没用过~
    学 Python 一定要学会的几个高阶函数
  • 原文地址:https://www.cnblogs.com/cwgk/p/4037450.html
Copyright © 2011-2022 走看看