Github user advancedxy commented on a diff in the pull request: https://github.com/apache/spark/pull/4783#discussion_r25992824 --- Diff: core/src/main/scala/org/apache/spark/util/SizeEstimator.scala --- @@ -49,6 +49,11 @@ private[spark] object SizeEstimator extends Logging { private val FLOAT_SIZE = 4 private val DOUBLE_SIZE = 8 + // Fields can be primitive types, sizes are: 1, 2, 4, 8. Or fields can be pointers. The size of + // a pointer is 4 or 8 depending on the JVM (32-bit or 64-bit) and UseCompressedOops flag. + // The sizes should be in descending order, as we will use that information for fields placement. + private val fieldSizes = List(8, 4, 2, 1) + // Alignment boundary for objects // TODO: Is this arch dependent ? private val ALIGN_SIZE = 8 --- End diff -- It's almost always 8 bytes. But, it can be set to other bytes by -XX:ObjectAlignmentInBytes= . See http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/test/gc/TestObjectAlignment.java, But I'd rather to deal with that in another pr. I am feeling it's a bit of more work here.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org