引入依赖 <dependency> <groupId>org.openjdk.jol</groupId> <artifactId>jol-core</artifactId> <version>0.9</version> </dependency> 测试代码 Object obj = new Object(); System.out.println(ClassLayout.parseInstance(obj).toPrintable()); 运行结果 对象内存布局图