ThreadLocal & Memory Leak

前端 未结 7 1296
Happy的楠姐
Happy的楠姐 2020-11-27 10:08

It is mentioned at multiple posts: improper use of ThreadLocal causes Memory Leak. I am struggling to understand how Memory Leak would happen using Thread

7条回答
  •  无人及你
    2020-11-27 10:14

    There is nothing inherently wrong with thread locals: They do not cause memory leaks. They are not slow. They are more local than their non-thread-local counterparts (i.e., they have better information hiding properties). They can be misused, of course, but so can most other programming tools…

    Refer to this link by Joshua Bloch

提交回复
热议问题