有时需要查看java对象占用了多少内存(对象大小),lucene为我们提供了一个很好的工具类,操作简单,如下:

 

        int[] s = new int[1024];
        System.out.println("size(s):" + RamUsageEstimator.humanSizeOf(s));

  

就这么简单!

相关文章:

  • 2021-09-15
  • 2021-07-15
  • 2021-10-02
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-03
  • 2022-01-04
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
相关资源
相似解决方案