Java Threads: Are They Memory Efficient?
A developer runs through an experiment that tested the memory use of Java threads and how to optimize your use of Java threads in your code. by
Join the DZone community and get the full member experience.Join For Free
Java applications tend to contain hundreds (sometimes thousands) of threads. The majority of these threads are in a WAITING or TIMED WAITING (i.e., dormant) state, while only a small portion are actively executing lines of code. So, we were curious to know whether dormant threads consume less memory than active threads.
To figure out the answer to this question, we conducted a small study.