“C的sizeof()”的等价物爪哇语
Possible Duplicate:
In Java, what is the best way to determine the size of an object?
What is the technique to retrieve the # of bytes occupied by a class object/variable in Java?
Looking for an equivalent for SizeOf() operator in C.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我之前在 Sourceforge 上使用过 SizeOf() 项目,并取得了不错的成功:
http://sourceforge.net/projects/ sizeof/
然而,基于 JVM 的工作方式,Java 的 Sizeof 充其量只是基于预定义参数的智能猜测,而不是实际测量内存分配的大小。
...所以将此作为信息来源而不是福音!
I've used the SizeOf() project on Sourceforge before with decent success:
http://sourceforge.net/projects/sizeof/
However, based on how the JVM works, Sizeof for java is, at best, an intelligent guess based on predefined parameters rather than actually measuring the size of the memory allocation.
...so use this as a source of information rather than gospel!