Is there any sizeof-like method in Java?

后端 未结 15 1080
暗喜
暗喜 2020-11-27 15:03

Is there any built-in method in Java to find the size of any datatype? Is there any way to find size?

15条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 15:49

    EhCache provides a SizeOf class that will try to use the Instrumentation agent and will fall back to a different approach if the agent is not loaded or cannot be loaded (details here).

    Also see the agent from Heinz Kabutz.

提交回复
热议问题