x64 进程可以在 4GB RAM 上占用多少内存 [英] How much memory can x64 process can take on 4GB RAM

查看:35
本文介绍了x64 进程可以在 4GB RAM 上占用多少内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 x64 应用程序.这是一个有点繁重的应用程序(就线程数、所需内存等而言).我在 4GB RAM 64 位 Windows7 四核机器上运行这个应用程序.但我注意到的是,在我的应用程序占用大约 2.2-2.3 GB 内存后它崩溃了.这是必需的行为吗?64 位应用程序最多只能从 4GB RAM 中占用 2.3-2.4 GB RAM 吗?

I have a x64 application. It is a bit heavy application (in terms of thread counts, memory needed etc). I'm running this application on a 4GB RAM 64-bit Windows7 Quad core machine. But what i notice is after my application takes around 2.2-2.3 GB Ram it crashes. Is this required behavious? Can 64bit applications at max take only 2.3-2.4 GB RAM from 4GB RAM?

推荐答案

RAM 的数量无关紧要,一个进程分配虚拟内存.您可以在 64 位进程中分配的虚拟内存量仅受操作系统提供页面以将虚拟内存映射到 RAM 的能力的限制.假设您没有使用 CreateFileMapping() 创建自己的映射,这通常仅受允许的最大分页文件的限制.它是一个系统设置,控制面板+系统+高级.Windows 版本也有上限,Windows 7 Home Premium 为 16 GB,Professional 及更高版本为 192 GB.

The amount of RAM is of no concern, a process allocates virtual memory. The amount of virtual memory you can allocate in a 64-bit process is only limited by the operating system's ability to provide pages to map the virtual memory to RAM. Which is normally only limited by the largest allowed paging file, assuming you didn't create your own mapping with CreateFileMapping(). It is a system setting, Control Panel + System + Advanced. There's an upper limit as well imposed by the Windows edition, 16 gigabytes for Windows 7 Home Premium, 192 gigabytes for Professional and up.

RAM 仅在您的程序实际访问虚拟内存时使用.当内存尚未映射时会产生页面错误.如果您在消耗所有可用页面之前分配和使用的内存远远超过 RAM 量,则 64 位进程通常会由于这些页面错误而变慢为爬行.

RAM is only used when your program actually accesses the virtual memory. Which generates a page fault when the memory isn't mapped yet. A 64-bit process typically slows down to a crawl due to these page faults if you allocate and use memory considerably beyond the amount of RAM, well before you consume all available pages.

由于您远远低于典型的最大分页文件大小,这肯定只是另一个普通的旧堆损坏错误.

Since you are considerably South of the typical maximum paging file size, this is surely just another plain old heap corruption bug.

这篇关于x64 进程可以在 4GB RAM 上占用多少内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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