java中引用变量的大小是多少 [英] what is the size of reference variable in java

查看:436
本文介绍了java中引用变量的大小是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java中引用变量的大小是多少?我很确定它不会依赖于架构,不是吗?它与C中指针的概念有什么相似之处吗?我有尝试,但无法得到任何令人信服的答案。

What is the size of reference variables in java? I am quite sure it wont be dependent upon the architecture or is it? Does it bear any resemblance with concept of pointers in C? I have tries but could not get any convincing answer.

推荐答案

引用使用的内存量取决于几个参数:

The amount of memory used by a reference depends on several parameters:


  • 在32位JVM上,在64位JVM上为32位

  • ,它可以是32位或64位,具体取决于配置。例如,在热点上,默认情况下会激活压缩的普通对象指针和参考的大小是32位。如果您使用 -XX:-UseCompressedOops 停用该选项,它们将使用64位。

  • on a 32-bit JVM, it will be 32 bits
  • on a 64-bit JVM, it can be 32 or 64 bits depending on configuration. On hotspot for example, compressed ordinary object pointers is activated by default and the size of a reference is 32 bits. If you deactivate the option with -XX:-UseCompressedOops, they will use 64 bits.

这篇关于java中引用变量的大小是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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