当前位置:网站首页>JVM four reference types
JVM four reference types
2022-07-28 18:48:00 【A dream without trace BZY】
One 、 Strong citation :
natural new When an object is referred to, it is a strong reference . You can manipulate objects directly by reference .gc Objects pointed to by strong references will not be recycled , Unless the reference is equal to null
Two 、 Soft citation
new Out SoftReference Nest other objects in its construction method

1、m Point to sr Strong citation ,sr Object points to byte array soft reference . Every time gc It will not actively clean up soft references , Only when there are other strong references , And if the space in the heap area is insufficient, it will be cleared . You can quote .get Method to get nested objects
2、 effect : Used to cache , Set some frequently used as soft references ( Give Way SoftReference Nesting things to be used in ), So it won't be gc Recycle , Can be used often . And when there is not enough memory , It can be killed by other strong references at any time
3、 ... and 、 Weak reference
new Out WeakReference Nest other objects in its construction method
1、 Memory diagram as above . As long as garbage collection starts, it will be recycled . You can quote .get Method to get nested objects
2、 effect : stay ThreadLocal To prevent memory leakage ( See the multi threading column ThreadLocal)
Four 、 Virtual reference
new Out PhantomReference Nest other objects in its construction method

You have to add a queue , Because every time I was returned
边栏推荐
- Go exe generates icon version information
- 专题讲座6 树形dp 学习心得(长期更新)
- Golang并发模型之
- Mingde biology: no products of the company have been listed in the WHO recommended list
- When golang encounters high concurrency seckill
- Unity 之 切换语言导致报错:System.FormatException:String was not recognized as a valid DateTime.
- APP为什么用JSON协议与服务端交互:序列化相关知识
- Golang is packaged and released to various platforms
- Look at Devops construction from SRE
- Tencent Tang Daosheng: open source is a new mode of production and collaboration in the era of industrial Internet
猜你喜欢

1.1. Sparse array

专题讲座6 树形dp 学习心得(长期更新)

MYSQL入门与进阶(四)

Record your interview experience in Xiamen for two years -- Conclusion

Unity 之 切换语言导致报错:System.FormatException:String was not recognized as a valid DateTime.

MySQL advanced mvcc (ultra detailed collation)

1.3、链表

2022-07-27 study notes of group 4 self-cultivation class (every day)
![[GXYCTF2019]StrongestMind](/img/f4/61932548e0c7dd60d790d31fb5b96b.png)
[GXYCTF2019]StrongestMind

三分钟了解快来新媒体
随机推荐
UE5 GAS 学习笔记 1.6 技能Gameplay Ability
Ue5 gas learning notes 1.7 task ability tasks
Golang 打包发布到各个平台
Ue5 gas learning notes 1.2 game Tags
Gaode map realizes customized small blue dots, customized point markers, drawing polygon / circular areas, and displaying or hiding customized point markers according to the movement of the map
Ue5 gas learning notes 0.2 configuration plug-in
First understanding of structure
记录自己在厦门两年来的面试经历--完结篇
不理解模块化、组件化、插件化的区别怎么行?
haproxy实现灰度发布
2022-07-27 第四小组 修身课 学习笔记(every day)
腾讯汤道生:开源是产业互联网时代新的生产方式和协作模式
.net swagger
MYSQL入门与进阶(五)
[GXYCTF2019]StrongestMind
redis优势以及数据结构相关知识
Is it really realistic that people who have not been exposed to software testing can take up their posts after two months of training?
Ue5 gas learning notes 0.1 case Preview
Ue5 gas learning notes 1.9 skill system global classes (abilitysystemglobals)
MySQL日期函数