[External] : Re: Virtual thread memory leak because TrackingRootContainer keeps threads

Ron Pressler ron.pressler at oracle.com
Wed Jul 31 14:10:25 UTC 2024



> On 25 Jul 2024, at 16:17, Robert Engels <robaho at icloud.com> wrote:
> 
> I have created a very simple unbounded FIFO queue designed for use with virtual threads to better ensure thread clean-up without the reliance of automatic clean-up of VTs.
> 
> You can review the project here https://github.com/robaho/closablequeue

Just to be clear, there is never any kind of “automatic clean-up” of virtual threads. The bytes holding the state of a virtual thread that cannot possibly continue may or may not be collected before it is terminated, but even if the memory is collected, no cleanup is performed. The only way the collection can be observed is through mechanism that observe the GC’s implementation choices, such as weak references, etc.

— Ron 


More information about the loom-dev mailing list