当前位置:网站首页>What is ThreadLocal memory leak and how to solve it
What is ThreadLocal memory leak and how to solve it
2022-07-02 00:14:00 【Add soldier】

Solid lines represent strong quotes , Dashed lines represent weak references
every last Thread Maintain a ThreadLocalMap, key For the use of Weak reference Of ThreadLocal example ,value Is a copy of the thread variable .
Strong citation , Use the most common quotation , An object has a strong reference , It won't be recycled by the garbage collector . When memory runs out of space ,Java The virtual machine would rather throw OutOfMemoryError error , Causes the program to terminate abnormally , And don't recycle the object .
If you want to disassociate a strong reference from an object , You can explicitly assign references to null, This will enable JVM The object will be recycled at the right time .
Weak reference ,JVM When recycling , Whether the memory is sufficient or not , All objects associated with weak references will be recycled . stay java in , use java.lang.ref.WeakReference Class .
边栏推荐
- Use vb Net to convert PNG pictures into icon type icon files
- Difficult to get up syndrome (bit by bit greed)
- SQL数据分析之流程控制语句【if,case...when详解】
- PHP reads ini or env type configuration
- GCC compilation
- Material design component - use bottomsheet to show extended content (I)
- B tree and b+tree of MySQL
- cookie、session、tooken
- Shell custom function
- 正则表达式收集
猜你喜欢
![[Qt] résoudre le problème que Qt msvc 2017 ne peut pas Compiler](/img/35/e458fd437a0bed4bace2d6d65c9ec8.png)
[Qt] résoudre le problème que Qt msvc 2017 ne peut pas Compiler

It's nothing to be utilitarian!

Database -- sqlserver details

RPA tutorial 01: Excel automation from introduction to practice

使用VB.net将PNG图片转成icon类型图标文件

Download the online video m3u8 tutorial

时间复杂度与空间复杂度

电商RPA机器人,助力品牌电商抢立流量高点

Concurrentskiplistmap -- principle of table skipping

TS initial use, TS type
随机推荐
[es practice] safe operation mode on ES
Use the htaccess file to prohibit the script execution permission in the directory
[embedded system course design] a single key controls the LED light
Practical calculation of the whole process of operational amplifier hysteresis comparator
多表操作-一对一,一对多与多对多
下载在线视频 m3u8使用教程
RPA教程01:EXCEL自动化从入门到实操
Jielizhi, production line assembly link [chapter]
ADO. Net SqlDataAdapter object
Selectively inhibiting learning bias for active sampling
. env. XXX file, with constant, but undefined
Using SqlCommand objects in code
USB-IF协会与各种接口的由来
如何提升数据质量
LeetCode中等题题分享(5)
比较通俗易懂的PID理解
S32Kxxx bootloader之UDS bootloader
const // It is a const object... class nullptr_ t
使用VB.net将PNG图片转成icon类型图标文件
Why does blocprovider feel similar to provider?