Saturday, June 29, 2013

Re: Memory growth in GWT Compiler

Should GWT be calling System.gc() by default after each permutation compile so that the heap does not grow? (Right now it does that only with the -Dgwt.memory.usage option) 

GWT calls System.gc() multiple times in order to give you more accurate memory statistics. GWT just wants to make sure that when it prints out stats for permutation 2 that there is no garbage left in memory from permutation 1 as this would distort the statistic.

Other than that GWT should not call the garbage collector after each permutation as it only costs additional time and doesn't buy you a lot. Sure your first graph without System.gc() does not look that uniform like the second graph, but it doesn't mean that you need more memory for compilation if you dont call System.gc(). 
What your first graph does not show is that the JVM will garbage collect on its own all the garbage left in memory from the previous permutations if there is not enough space anymore in the heap. But in your example there is enough heap and thus the JVM is not forced to clean up more memory than it absolutely needs to.
Before a JVM needs to throw an OutOfMemoryException if will absolutely try everything to free up as much memory as possible. 

Try to run your compilation with 2GB heap and without memory dumping. 2GB is slightly below your highest peak in the first graph. Then compare the result to your first graph which has used 3GB heap. I would bet that compilation still works and you will see a slightly different graph at the end of the compilation because the JVM is forced to do a bit more garbage collection on its own.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment