<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                Go中的內存分類并不像TCMalloc那樣分成小、中、大對象,但是它的小對象里又細分了一個Tiny對象,Tiny對象指大小在1Byte到16Byte之間并且不包含指針的對象。 小對象和大對象只用大小劃定,無其他區分。 大對象指大小大于32kb.小對象是在mcache中分配的,而大對象是直接從mheap分配的,從小對象的內存分配看起。 Go的內存分配原則: Go在程序啟動的時候,會先向操作系統申請一塊內存(注意這時還只是一段虛擬的地址空間,并不會真正地分配內存),切成小塊后自己進行管理。 申請到的內存塊被分配了三個區域,在X64上分別是512MB,16GB,512GB大小。 [![](https://github.com/KeKe-Li/data-structures-questions/raw/master/src/images/134.jpg)](https://github.com/KeKe-Li/data-structures-questions/blob/master/src/images/134.jpg) arena區域就是我們所謂的堆區,Go動態分配的內存都是在這個區域,它把內存分割成8KB大小的頁,一些頁組合起來稱為mspan。 bitmap區域標識arena區域哪些地址保存了對象,并且用4bit標志位表示對象是否包含指針、GC標記信息。bitmap中一個byte大小的內存對應arena區域中4個指針大小(指針大小為 8B )的內存,所以bitmap區域的大小是`512GB/(4*8B)=16GB`。 [![](https://github.com/KeKe-Li/data-structures-questions/raw/master/src/images/135.jpg)](https://github.com/KeKe-Li/data-structures-questions/blob/master/src/images/135.jpg) [![](https://github.com/KeKe-Li/data-structures-questions/raw/master/src/images/136.jpg)](https://github.com/KeKe-Li/data-structures-questions/blob/master/src/images/136.jpg) 此外我們還可以看到bitmap的高地址部分指向arena區域的低地址部分,這里bitmap的地址是由高地址向低地址增長的。 spans區域存放mspan(是一些arena分割的頁組合起來的內存管理基本單元,后文會再講)的指針,每個指針對應一頁,所以spans區域的大小就是`512GB/8KB*8B=512MB`。 除以8KB是計算arena區域的頁數,而最后乘以8是計算spans區域所有指針的大小。創建mspan的時候,按頁填充對應的spans區域,在回收object時,根據地址很容易就能找到它所屬的mspan。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看