Skip to content

Commit 915ab97

Browse files
committed
Make error reporting less scary if we can't look up UseCompressedOops
1 parent a417cd4 commit 915ab97

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

core/src/main/scala/spark/SizeEstimator.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,12 @@ object SizeEstimator extends Logging {
8383
hotSpotMBeanName, classOf[HotSpotDiagnosticMXBean]);
8484
return bean.getVMOption("UseCompressedOops").getValue.toBoolean
8585
} catch {
86-
case e: IllegalArgumentException => {
87-
logWarning("Exception while trying to check if compressed oops is enabled", e)
88-
// Fall back to checking if maxMemory < 32GB
89-
return Runtime.getRuntime.maxMemory < (32L*1024*1024*1024)
90-
}
91-
92-
case e: SecurityException => {
93-
logWarning("No permission to create MBeanServer", e)
94-
// Fall back to checking if maxMemory < 32GB
95-
return Runtime.getRuntime.maxMemory < (32L*1024*1024*1024)
86+
case e: Exception => {
87+
// Guess whether they've enabled UseCompressedOops based on whether maxMemory < 32 GB
88+
val guess = Runtime.getRuntime.maxMemory < (32L*1024*1024*1024)
89+
val guessInWords = if (guess) "yes" else "not"
90+
logWarning("Failed to check whether UseCompressedOops is set; assuming " + guessInWords)
91+
return guess
9692
}
9793
}
9894
}

0 commit comments

Comments
 (0)