ThreadLocal Is a Memory Leak Waiting to Happen With Virtual Threads — Here’s the Proof (opens in new tab)
ThreadLocal was designed for a world of 200 pooled platform threads living for the life of an application. Virtual threads create one fresh thread per task and never reuse them. The two assumptions are incompatible — and your production heap is paying the price. When JEP 444 shipped virtual threads in Java 21, most of the production …
Read the original article