Query about heap memory consumption of Virtual Thread

Alan Bateman Alan.Bateman at oracle.com
Thu Aug 25 16:48:52 UTC 2022



On 25/08/2022 16:54, Ron Pressler wrote:
> Hi.
>
> The stack representation for virtual threads is currently not as 
> compact as we’d like it to be, and we’re now working on reducing it, 
> possibly drastically. So yes, it is possible that the application will 
> require more heap space, but whether that’s the case, or by how much 
> is very much application-dependent, so you’ll need to track the heap 
> usage and allocate heap space appropriately.
>
> Virtual threads are lightweight in the sense that they consume much 
> less precious resources than platform threads, and that is why you can 
> have many more of them than platform threads. The resource consumption 
> by platform threads is much more constrained than for virtual threads, 
> even in their current state. We expect the heap consumption to be 
> reduced in a future version.
>
Also just to add that the jconsole screen shots are only showing the 
heap memory so you can't see the memory reserved/committed for the 3000+ 
platform threads that running in the VM corresponding to the left screen 
shot.

-Alan


More information about the loom-dev mailing list