//引入pom依赖<dependency> <groupId>com.carrotsearch</groupId><artifactId>java-sizeof</artifactId><version>0.0.5</version></dependency>

//获取对象大小RamUsageEstimator.sizeOf()//获取对象格式化后的大小RamUsageEstimator.humanSizeOf()