{
  "schemaVersion": "0.11.0",
  "canonical": "https://www.pystone.net/notes/uwa-answer-32-and-64-bit-process-address-space/",
  "atlas": "https://www.pystone.net/?node=uwa-answer-32-and-64-bit-process-address-space#knowledge-atlas",
  "markdown": "https://www.pystone.net/notes/uwa-answer-32-and-64-bit-process-address-space.md",
  "context": "https://www.pystone.net/notes/uwa-answer-32-and-64-bit-process-address-space.context.json",
  "knowledgeVersion": "224c990773de.5fa8af6e39fa",
  "build": {
    "siteCommit": "224c990773de166d23a886306577dd90379529ce",
    "notesCommit": "5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a",
    "builtAt": "1970-01-01T00:00:00.000Z",
    "version": "224c990773de.5fa8af6e39fa"
  },
  "id": "note:uwa-answer-32-and-64-bit-process-address-space",
  "slug": "uwa-answer-32-and-64-bit-process-address-space",
  "title": "关于32位进程最多能分配1.5GB，64位进程最多能分配8TB的问题",
  "type": "note",
  "visibility": "public",
  "idStability": "rename-stable",
  "author": {
    "name": "石心.Yong"
  },
  "publisher": {
    "name": "Perrin Yong",
    "profile": "https://www.pystone.net/profile/"
  },
  "aliases": [],
  "summary": "关于32位进程最多能分配1.5GB，64位进程最多能分配8TB的问题",
  "contentRole": "source",
  "sourceType": "source",
  "sourceMetadata": {
    "author": "石心.Yong"
  },
  "isMoc": false,
  "mocRecognition": "none",
  "generated": false,
  "attribution": "external_source",
  "domain": "10-计算机、信息技术与工程",
  "tags": [],
  "mocs": [],
  "contentHash": "adab179346afdcc809e22173f0983123ee711355c2c25a6bc3c90b77074bc9b9",
  "assets": [
    {
      "reference": "assets/60d8817ae58b4719dd3e27f7/01.png",
      "url": "/media/fb9af7e980ba83ec3968.png",
      "mediaType": "image/png",
      "contentHash": "fb9af7e980ba83ec39680a986a2a82d55ccc5b1a111e8bf913138b3636dd77ba",
      "byteLength": 24104,
      "width": 954,
      "height": 233
    },
    {
      "reference": "assets/60d8817ae58b4719dd3e27f7/02.png",
      "url": "/media/dbac33e1a9d48927e26f.png",
      "mediaType": "image/png",
      "contentHash": "dbac33e1a9d48927e26f05d0025f5af5a03376a46e110f7ca2c6311d0581e1ba",
      "byteLength": 40237,
      "width": 880,
      "height": 135
    }
  ],
  "headings": [
    {
      "depth": 1,
      "text": "关于32位进程最多能分配1.5GB，64位进程最多能分配8TB的问题",
      "anchor": "关于32位进程最多能分配15gb64位进程最多能分配8tb的问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-32-and-64-bit-process-address-space/#%E5%85%B3%E4%BA%8E32%E4%BD%8D%E8%BF%9B%E7%A8%8B%E6%9C%80%E5%A4%9A%E8%83%BD%E5%88%86%E9%85%8D15gb64%E4%BD%8D%E8%BF%9B%E7%A8%8B%E6%9C%80%E5%A4%9A%E8%83%BD%E5%88%86%E9%85%8D8tb%E7%9A%84%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "问题",
      "anchor": "问题",
      "citation": "https://www.pystone.net/notes/uwa-answer-32-and-64-bit-process-address-space/#%E9%97%AE%E9%A2%98"
    },
    {
      "depth": 2,
      "text": "我的回答",
      "anchor": "我的回答",
      "citation": "https://www.pystone.net/notes/uwa-answer-32-and-64-bit-process-address-space/#%E6%88%91%E7%9A%84%E5%9B%9E%E7%AD%94"
    },
    {
      "depth": 2,
      "text": "来源与关系",
      "anchor": "来源与关系",
      "citation": "https://www.pystone.net/notes/uwa-answer-32-and-64-bit-process-address-space/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "claims": [],
  "outgoing": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "上位集合：我的 UWA 问答",
      "citation": "https://www.pystone.net/notes/uwa-answer-32-and-64-bit-process-address-space/#%E6%9D%A5%E6%BA%90%E4%B8%8E%E5%85%B3%E7%B3%BB"
    }
  ],
  "incoming": [
    {
      "id": "note:my-uwa-answers",
      "title": "我的 UWA 问答",
      "url": "https://www.pystone.net/notes/my-uwa-answers/",
      "atlas": "https://www.pystone.net/?node=my-uwa-answers#knowledge-atlas",
      "label": "我的 UWA 问答",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "2021-06-28：关于32位进程最多能分配1.5GB，64位进程最多能分配8TB的问题（Script）",
      "citation": "https://www.pystone.net/notes/my-uwa-answers/#2021"
    },
    {
      "id": "note:game-graphics-and-runtime",
      "title": "游戏图形与运行时",
      "url": "https://www.pystone.net/notes/game-graphics-and-runtime/",
      "atlas": "https://www.pystone.net/?node=game-graphics-and-runtime#knowledge-atlas",
      "label": "游戏图形与运行时",
      "origin": "explicit",
      "humanReviewed": true,
      "context": "我的UWA问答中的“2021-06-28 - 关于32位进程最多能分配1.5GB，64位进程最多能分配8TB的问题”导航项",
      "citation": "https://www.pystone.net/notes/game-graphics-and-runtime/#%E6%88%91%E7%9A%84uwa%E9%97%AE%E7%AD%94"
    }
  ],
  "contentMarkdown": "# 关于32位进程最多能分配1.5GB，64位进程最多能分配8TB的问题\n\n> [!note] 我的 UWA 问答\n> 本文收录我在 UWA 问答发表的公开回答。问题内容归原提问者；回答保留当时语境，技术结论可能受 Unity 版本、平台和项目条件限制。\n\n## 问题\n\n有大佬能解释一下这是什么意思，最多可分配的怎么算的，怎么感觉这句话不太对\n\n- 提问者：程序猿小Y\n- 提问时间：2021-06-28 05:47:38\n\n## 我的回答\n\n从硬件的层面讲，CPU可用的内存范围受到寻址方式以及地址线的数量的影响，例如32位地址线，按字节寻址，则地址空间大小为2^32B = 4GB。程序可用的内存空间由于类似的原因受到限制，有如下结论：\n\n- 操作系统能使用的物理内存受CPU、主板等的硬件的限制，以及操作系统本身的限制。\n- 应用程序的内存受进程的虚拟地址空间限制\n- 虚拟地址空间取决于虚拟地址的位数\n\n首先讲物理内存，一般情况下32位的CPU的地址总线是32位，32位的操作系统中，理论上最大支持的物理内存为4G，实际上只有3.2G左右（显卡等设备占用一部分）。\n\n而进程可分配内存大小其实取决于虚拟内存，而虚拟地址空间一部分用于用户模式，一部分用于内核模式(一般各分一半)。\n\n32位系统的虚拟内存大小为4GB，用户模式的虚拟地址空间大小为2GB，这个应该可以解释 CLR在32位进程上只能分配1.5GB内存。64位系统不同的版本有不同的虚拟地址空间限制。笔者的Win10虚拟地址位数为48，支持的地址空间大小为256TB，而User-mode的地址空间大小则为128TB。一部分Windows系统的User-mode地址空间大小为8 TB，如下图：\n\n![image.png](assets/60d8817ae58b4719dd3e27f7/01.png)\n\n推测CLR在64位进程上能分配8TB内存的限制与此有关。\n\n###\n\n继答主回复后更新：\n\n题主求真务实的精神很值得肯定。首先纠正一点错误，物理内存不受限于虚拟内存，虚拟内存也不直接受限于物理内存。再看一看《现代操作系统》 第8章就明白了。\n\n有两点建议：\n\n- 书是一种帮助我们理解事物的工具，建议任何一种书都不要当作教科书去看，更不要当作真理去看。要追求前后贯通，理解本质，有时候不用太咬文嚼字。\n- 读英文书的中文译本，如果遇到解释不通的地方，就去读英文原版。\n\n中文版的这句话翻译是极其不准确的，看英文版如下：\n\n![image.png](assets/60d8817ae58b4719dd3e27f7/02.png)\n\n“在32位进程中，你能分配的空间接近1.5GB。”与“32位进程最多能分配1.5GB。”简直是天壤之别。原书这段话的题目是 **Allocating Resources from the Managed Heap**，那么这句话讲的可分配的内存特指**堆内存**。进程的内存当然不止有托管堆，还包括代码区，全局区，栈区等。\n\n至于说是受限于2GB还是3GB，这本书其实没有讨论我们把用户模式的地址空间调整成3GB的情况。\n\n- 回答时间：2021-06-28 09:06:36\n- 最后更新：2021-06-29 00:44:57\n- 采纳状态：已采纳\n\n## 来源与关系\n\n- 上位集合：[[10-计算机、信息技术与工程/05-游戏图形与运行时/我的UWA问答/我的UWA问答|我的 UWA 问答]]\n- UWA 标签：Script\n- 原始问题：[关于32位进程最多能分配1.5GB，64位进程最多能分配8TB的问题](https://answer.uwa4d.com/question/60d8817ae58b4719dd3e27f7)\n- 源页最后更新：2021-06-28 09:06:36\n"
}
