Can I eliminate pauses caused by garbage collection?
If you find the garbage collection pauses too intrusive you can try switching to a different garbage collection algorithm.
You can set one of the following switches in etc/netbeans.conf or on the command-line when you start Netbeans:
- -J-XX:+UseConcMarkSweepGC or -J-XX:+UseParNewGC
- this switch causes the JVM to use different algorithms for major garbage collection events (also for minor collections, if run on a multiprocessor workstation), ones which do not "stop the world" for the entire garbage collection process. If you are using the PermSize switch, you should also use -J-XX:+CMSClassUnloadingEnabled and -J-XX:+CMSPermGenSweepingEnabled so that class unloading is enabled (it isn't by default when using this collector).
- some tests have shown that, at least on systems fairly well equipped with memory, the durations of minor garbage collections is halved when using this collection algorithm, on uniprocessor systems. Note that this is paradoxical - this collector is designed to work best on multiprocessor systems with gigabyte heaps. No data is available on its effect on major garbage collections. Note: this collector is mutually exclusive with -J-XX:+UseConcMarkSweepGC.
Applies to: NetBeans 4.x and newer
See also: Tuning JVM Switches for performance