需要引入的jar包:

<dependency>
    <groupId>com.carrotsearch</groupId>
    <artifactId>java-sizeof</artifactId>
    <version>0.0.5</version>
</dependency>

在代码中使用如下即可:

System.out.println(RamUsageEstimator.sizeOf(object) + "B");

 

相关文章:

  • 2022-12-23
  • 2021-12-23
  • 2021-11-04
  • 2021-12-13
  • 2022-12-23
  • 2021-05-21
  • 2021-11-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
相关资源
相似解决方案