File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed 
jdk/src/main/java/com/tenstone/jdk/juc/locks Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1010@ Slf4j 
1111public  class  JOLObjectHeaderDemo  {
1212
13+     static  class  TestObj {
14+         private  long  p1 ;
15+         private  byte  p2 ;
16+         private  long  p3 ;
17+         private  long  p4 ;
18+     }
19+ 
1320    /** 
1421     * 对象头 
1522     * 1. mark word (8 bytes) hashCode,锁标志位,gc年龄 
@@ -19,6 +26,7 @@ public class JOLObjectHeaderDemo {
1926     * @param args 
2027     */ 
2128    public  static  void  main (String [] args ) {
29+         final  TestObj  testObj  = new  TestObj ();
2230        log .debug ("\n =========================================VM.current.details()====================================" );
2331        log .debug ("{}" , VM .current ().details ());
2432        log .debug ("\n =========================================String.class============================================" );
@@ -30,6 +38,6 @@ public static void main(String[] args) {
3038        hello .hashCode ();
3139        log .debug ("{}" , ClassLayout .parseInstance (hello ).toPrintable ());
3240        log .debug ("\n =========================================empty String============================================" );
33-         log .debug ("{}" , ClassLayout .parseInstance ("" ).toPrintable ());
41+         log .debug ("{}" , ClassLayout .parseInstance (testObj ).toPrintable ());
3442    }
3543}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments