Java:引用意味着多少内存? [英] Java: How much memory a reference implies?

查看:110
本文介绍了Java:引用意味着多少内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如问题所说,在Java编程语言中对一个对象的引用使用了多少内存?

As the question says, how much memory is used for a reference to an Object in the Java Programming Language?

如果你有一个可靠的来源,请更好。

Please, if you have a trusted source is better.

非常感谢!

推荐答案

它没有指定语言或JVM规范。但是,通常认为任何理智的实现在32位计算机上都是4个字节,在64位计算机上是4到8个字节(取决于压缩指针设置等)。

It's not specified by the language or JVM spec. However, it's generally accepted that any sane implementation will be 4 bytes on a 32-bit machines and between 4 and 8 bytes (depending on compressed pointer settings, etc.) on a 64-bit machine.

这篇关于Java:引用意味着多少内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆