Github user shivaram commented on the pull request:

    https://github.com/apache/spark/pull/4783#issuecomment-76138824
  
    @advancedxy -- Thanks for the detailed writeup and the gist. I can see the 
problem but I am not sure this is the complete fix.  You are right that 
shellSizes don't need to be aligned to 8 bytes for superclasses and the 
alignment only needs to happen on object boundaries.  However I am not sure 
this completely extends all the way -- i.e. when the super class has say a 1 
byte field then I don't think we can start counting from 13 (12 for Object + 1 
for byte).
    
    While looking around I found this very nice tool called the Java Object 
Layout [1] which prints out the layout with alignment, gaps given an object 
name. You can see an example of the alignment gaps I am talking about in [2]  
where super-classes with boolean fields end up being aligned to 4 bytes by 
hotspot (I have no idea what the IBM / Oracle JVMs do).
    
    I'll try to think if there is a more elegant fix and if not we can go with 
this.
    
    cc @rxin
    
    [1] http://openjdk.java.net/projects/code-tools/jol/
    [2] 
http://hg.openjdk.java.net/code-tools/jol/file/6df1a9b2e5da/jol-samples/src/main/java/org/openjdk/jol/samples/JOLSample_06_Gaps.java
 


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to