Query about heap memory consumption of Virtual Thread

Anindya Bandopadhyay anindyabandopadhyay at gmail.com
Thu Aug 25 02:31:23 UTC 2022


Hi,
I am just curious about the heap memory consumption of Virtual Threads.

[image: image.png]
Code Link Here
<https://gist.githubusercontent.com/andysundar/6401e20fee5674ae47fd94778d37f752/raw/c95905c45cbae47cbb66c3fe46e48f13dcaf19a9/VirtualThreadScaleExample.java>

In the above code I am switching the thread factory in line number 10. I
was just trying to analyze performance statistics and what I discovered is
that virtual thread consumes a significant amount of heap memory (may be
due to the continuation objects put into heap memory) with respect to
platform thread.


   1. Do we need to increase the size of heap memory if we are using
   virtual thread?
   2. What do you mean by "virtual threads are lightweight" ?


[image: image.png]

Will be eagerly waiting for your reply.

Regards;
Anindya Bandopadhyay
<http://www.linkedin.com/in/anindyabandopadhyay>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20220825/ff110631/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 303167 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20220825/ff110631/image-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 715436 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20220825/ff110631/image-0003.png>


More information about the loom-dev mailing list