-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TransmittableThreadLocal会不会有内存泄漏的风险? #281
Comments
简单地说:不显式调用
|
@yexuerui 有涉及出现内存泄漏、具体业务场景下碰到的实际问题吗?
|
因为
前提:
代码验证也就是在第一次创建 那么上述,如何清除泄漏的对象呢? 我理解 在 我个人理解,普通线程池(非 |
1. 关于
|
TransmittableThreadLocal
一般为静态变量;Spring
的bean
中声明(单例模式)。TransmittableThreadLocal
一直被强引用持有。那么
holder
即使设计的为InheritableThreadLocal<WeakHashMap<TransmittableThreadLocal<Object>, ?>>
,若不在子线程显式调用
remove()
方法,也不会被GC
回收吧。The text was updated successfully, but these errors were encountered: