1. <small id='GkFcA'></small><noframes id='GkFcA'>

      <legend id='GkFcA'><style id='GkFcA'><dir id='GkFcA'><q id='GkFcA'></q></dir></style></legend>
      <i id='GkFcA'><tr id='GkFcA'><dt id='GkFcA'><q id='GkFcA'><span id='GkFcA'><b id='GkFcA'><form id='GkFcA'><ins id='GkFcA'></ins><ul id='GkFcA'></ul><sub id='GkFcA'></sub></form><legend id='GkFcA'></legend><bdo id='GkFcA'><pre id='GkFcA'><center id='GkFcA'></center></pre></bdo></b><th id='GkFcA'></th></span></q></dt></tr></i><div id='GkFcA'><tfoot id='GkFcA'></tfoot><dl id='GkFcA'><fieldset id='GkFcA'></fieldset></dl></div>

          <bdo id='GkFcA'></bdo><ul id='GkFcA'></ul>
      1. <tfoot id='GkFcA'></tfoot>

        Integer vs int:关于内存

        时间:2023-10-01
        <legend id='a6PSn'><style id='a6PSn'><dir id='a6PSn'><q id='a6PSn'></q></dir></style></legend>
                <tbody id='a6PSn'></tbody>

                <i id='a6PSn'><tr id='a6PSn'><dt id='a6PSn'><q id='a6PSn'><span id='a6PSn'><b id='a6PSn'><form id='a6PSn'><ins id='a6PSn'></ins><ul id='a6PSn'></ul><sub id='a6PSn'></sub></form><legend id='a6PSn'></legend><bdo id='a6PSn'><pre id='a6PSn'><center id='a6PSn'></center></pre></bdo></b><th id='a6PSn'></th></span></q></dt></tr></i><div id='a6PSn'><tfoot id='a6PSn'></tfoot><dl id='a6PSn'><fieldset id='a6PSn'></fieldset></dl></div>

              1. <tfoot id='a6PSn'></tfoot>

                <small id='a6PSn'></small><noframes id='a6PSn'>

                • <bdo id='a6PSn'></bdo><ul id='a6PSn'></ul>
                  本文介绍了Integer vs int:关于内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想知道是否有不同的内存占用整数 nint n.

                  I was wondering if there is a difference in the memory occupied by Integer n, and int n.

                  我知道int n正常占用4个字节,Integer n

                  I know int n occupies 4 bytes normally, how about Integer n

                  推荐答案

                  一般来说,Hotspot中Java对象使用的堆内存包括:

                  In general, the heap memory used by a Java object in Hotspot consists of:

                  • 一个对象头,由几个字节的管家"信息组成;
                  • 原始字段的内存,根据其大小(int n->32 位)
                  • reference 字段的内存(每个 4 字节)(整数 n ->32 位)
                  • 填充:在对象数据之后可能会浪费"一些未使用的字节,以使每个对象从一个方便的字节倍数的地址开始,并减少表示指向对象的指针所需的位数.
                  • an object header, consisting of a few bytes of "housekeeping" information;
                  • memory for primitive fields, according to their size (int n->32 bits)
                  • memory for reference fields (4 bytes each) (Integer n ->32 bits)
                  • padding: potentially a few "wasted" unused bytes after the object data, to make every object start at an address that is a convenient multiple of bytes and reduce the number of bits required to represent a pointer to an object.

                  根据 Mark Peters 的建议,我想添加下面的链接http://www.javamex.com/tutorials/memory/object_memory_usage.shtml

                  as per the suggestion of Mark Peters I would like add the link below http://www.javamex.com/tutorials/memory/object_memory_usage.shtml

                  这篇关于Integer vs int:关于内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何将 Int 转换为无符号字节并返回 下一篇:为什么不能在 Java 中将 Integer 转换为 String?

                  相关文章

                  最新文章

                  <tfoot id='CptZB'></tfoot>

                    <legend id='CptZB'><style id='CptZB'><dir id='CptZB'><q id='CptZB'></q></dir></style></legend>

                      • <bdo id='CptZB'></bdo><ul id='CptZB'></ul>
                      <i id='CptZB'><tr id='CptZB'><dt id='CptZB'><q id='CptZB'><span id='CptZB'><b id='CptZB'><form id='CptZB'><ins id='CptZB'></ins><ul id='CptZB'></ul><sub id='CptZB'></sub></form><legend id='CptZB'></legend><bdo id='CptZB'><pre id='CptZB'><center id='CptZB'></center></pre></bdo></b><th id='CptZB'></th></span></q></dt></tr></i><div id='CptZB'><tfoot id='CptZB'></tfoot><dl id='CptZB'><fieldset id='CptZB'></fieldset></dl></div>

                      <small id='CptZB'></small><noframes id='CptZB'>