Java查看对象占多少内存
1.导入依赖
<dependency>
<groupId>org.openjdk.jol</groupId>
<artifactId>jol-core</artifactId>
<version>0.10</version>
</dependency>
2.打印对象
String s = ClassLayout.parseInstance(this).toPrintable();
log.info(s);
3.输出结果