Reputation: 113
i use "-XX:+UseConcMarkSweepGC" in my application, and when Out Of Memory Error is close my application transform in weakly form of itself (in this time it logs "concurrent mode failure").In this form it can survive long time period, and that is a big trouble for me. I need to find way how to help my application to "die fast and easy".
i googled this: "-XX:GCHeapFreeLimit=nnn where nnn is a number between 0 and 100 giving the minimum percentage of the heap that must be free after the GC. The default is 2" but i have trouble with it. i configure my JVM using "-XX:GCHeapFreeLimit=50" and i think it doesn't change anything
log 2013-08-14T17:31:49.776+0400: [Full GC [CMS: 917504K->908590K(917504K), 2.8014727 secs] 1032192K->908590K(1032192K), [CMS Perm : 2071K->2071K(65536K)], 2.8015412 secs] [Times: user=2.79 sys=0.00, real=2.80 secs]
1032192K->908590K(1032192K) - this is not 50 persents
Upvotes: 1
Views: 231
Reputation: 718826
I think you are saying that your application is spending too much time on garbage collection when the heap gets close to full.
If so, there is a simple thing that you can do that may help: add the -XX:+UseGCOverheadLimit
command line option. This causes the JVM to track how much time is spent on "GC overheads". If the proportion of time exceeds a given (configurable) ratio, the JVM will raise an OutOfMemoryError
exception.
Obviously, this will cause your application to die sooner. But it sounds like that what you want: a quick death, rather than a slow lingering one.
According to this page, the default ratio is 98% application, 2% gc. I might be incorrect about the ratio being tunable. If not, I suspect that it might be this one: -X:GCTimeLimit=nn
Upvotes: 2