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

Ron Pressler ron.pressler at oracle.com
Thu Aug 1 14:39:30 UTC 2024



> On 1 Aug 2024, at 11:08, robert engels <robaho at icloud.com> wrote:
> 
> And actually it is even worse than that , because if you are relying on the differing behavior between virtual threads and platform threads to avoid resource leaks in your application, god help you. 

I don’t know how you can use virtual threads and *not* rely on their different resource (and especially memory) consumption from platform threads. After all, virtual threads are a feature that allows the creation of many threads, and that is accomplished through different memory management. In other words, you use virtual threads *because* they use memory differently from platform threads (although, as I mentioned in other responses, I think you’re making some incorrect assumptions about how threads, including platform threads retain references, and it is not true that a reference that is logically on the stack is always retained).

“Thread leak” is a real problem in languages that allow creating lots of lightweight threads, such as Go.

— Ron


More information about the loom-dev mailing list