In this past, I have seen that .NET apps that explicitly call the garbage collector improved performance, especially when dealing with black-box code that doesn't dispose of objects itself nicely or bloats memory due to poor design. I have also seen where it will destroy performance for every .NET application on the machine.
In .NET 4.6 RC,
- Enhancements to garbage collection (GC)The GC class now includes TryStartNoGCRegion and EndNoGCRegion methods that allow you to disallow garbage collection during the execution of a critical path.A new overload of the GC.Collect(Int32, GCCollectionMode, Boolean, Boolean) method allows you to control whether both the small object heap and the large object heap are swept and compacted or swept only.
http://stackoverflow.com/questions/118633/whats-so-wrong-about-using-gc-collect
At this point, suppose that performance plays a fundamental role and the slightest alteration in the program's flow could bring catastrophic consequences. Object creation is then reduced to the minimum possible by using object pools and the such but then, the GC chimes in unexpectedly and throws it all away, and someone dies.
Well that got dark really fast, stackoverflow.
Oracle has a good document around the concepts of the Heap and the Nursery. When the nursery fills up, the older ones leave to public school. When public school fills up, the oldest are forced out into the real world.
https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/garbage_collect.html
Databricks, the Spark folks, and Intel, recently posted a great article about how GC works with Spark and how to tune Spark instances for optimized JVM garbage collection which inspired (and augmented some content for) this post.
https://databricks.com/blog/2015/05/28/tuning-java-garbage-collection-for-spark-applications.html
No comments:
Post a Comment