kiszk commented on a change in pull request #34846:
URL: https://github.com/apache/spark/pull/34846#discussion_r767179124
##########
File path: core/src/main/scala/org/apache/spark/util/Utils.scala
##########
@@ -3204,6 +3205,33 @@ private[spark] object Utils extends Logging {
}
files.toSeq
}
+
+ private def isG1GarbageCollector: Boolean = {
+ ManagementFactory.getGarbageCollectorMXBeans
+ .asScala
+ .exists(g =>
+ g.getName.equalsIgnoreCase("G1 Young Generation") ||
+ g.getName.equalsIgnoreCase("G1 Old Generation"))
+ }
+
+ /**
+ * Return true if current GC algorithm is G1 GC and the requested sizeInBytes
+ * are larger than 50% of the region size in G1.
+ */
+ def isHumongousAllocation(sizeInBytes: Long): Boolean = {
+ if (isG1GarbageCollector) {
+ try {
+ val heapRegionSize = ManagementFactory
Review comment:
Can we get this value only once by make it `def ...` as above? I think
this value is defined at JVM launch time.
So, we can reduce runtime overhead to access MxBean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]