Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think you have a misunderstanding on how the JVM works. This is not a GC issue or a "task" issue.</p> <p>Your tasks have memory leaks or they are designed to hold onto more and more memory.</p> <p>-Xmx1024m sets the maximum memory the JVM can allocate. It'd be the same thing as if you only have 1024 megs of physical memory and no virtual memory.</p> <p>It would be helpful to update your question with the definition of Task. Are these 5 separate JVM's? Or just 5 units of work in a single JVM.</p> <p><strong>Update</strong></p> <blockquote> <p>I don't intend the program to use all 1g heap always. My intention is to instruct the JVM to use 512m heap if can manage and to use more memory only if required. When the memory is no more required, to fall back to 512m or even less amount of memory.</p> </blockquote> <p>Just because you set -Xmx1024m does not mean the JVM WILL use all that memory. It's just a max limit. Setting Xms till set a minimum amount of memory to be used. Your program ultimately determines the running amount of memory being utilized. If it hits the limit set by -Xmx then it will throw an OutOfMemoryError</p> <p>You can suggest to the JVM to run the Garbage Collector by invoking <code>System.gc()</code>. Notice I said suggest, you cannot force the GC to run. You could be running on a platform that refuses to even do GC. You also need to look into what GC algorithm it is choosing for your application. I would look here <a href="http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html" rel="nofollow">Tuning Garbage Collector</a>.</p> <p>If you need such fine grain controls over memory usage you will need to pick something else besides the JVM.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload