It appears that currently there's no way to create a thread
without inheriting inheritable Thread Local Storage (duh), and context
class loader.
This is unfortunate as jdk spawns a lot of long-lived
threads (for example, all shutdown hooks are threads), and
most of them created from user threads, and thus could cause
leaks both by holding on to TLS and context class loader.
(The latter could be addressed by resetting the CCS)
without inheriting inheritable Thread Local Storage (duh), and context
class loader.
This is unfortunate as jdk spawns a lot of long-lived
threads (for example, all shutdown hooks are threads), and
most of them created from user threads, and thus could cause
leaks both by holding on to TLS and context class loader.
(The latter could be addressed by resetting the CCS)
- relates to
-
JDK-6254531 (thread) Provide reclaimable thread local values without Thread termination
- Open
-
JDK-6558265 (thread) Using thread locals with thread pools may lead to unintentional object retention
- Open
-
JDK-4219095 inheritable thread locals: need way to snapshot and recreate complete state
- Closed
-
JDK-6489540 The Disposer thread could cause memory leaks in user applications
- Closed