简体   繁体   English

x64进程可以在4GB RAM上占用多少内存

[英]How much memory can x64 process can take on 4GB RAM

I have a x64 application. 我有一个x64应用程序。 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. 我在4GB RAM 64位Windows7 Quad核心机上运行此应用程序。 But what i notice is after my application takes around 2.2-2.3 GB Ram it crashes. 但我注意到的是,在我的应用程序需要大约2.2-2.3 GB Ram后,它会崩溃。 Is this required behavious? 这是必要的吗? Can 64bit applications at max take only 2.3-2.4 GB RAM from 4GB RAM? 64位应用程序最大可以从4GB RAM只占用2.3-2.4 GB RAM吗?

No, check that you don't have any overflows or other bugs first. 不,请先检查您是否有任何溢出或其他错误。 Even 32-bit applications can address - use more RAM, so it would be ridiculous if it was limited on windows 64-bit. 即使是32位应用程序也可以解决 - 使用更多内存,因此如果它在Windows 64位上受限制将是荒谬的。

The remaining memory is free for use, right? 剩下的内存是免费使用的吧?

The amount of RAM is of no concern, a process allocates virtual memory. RAM的数量无关紧要,进程分配虚拟内存。 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. 您可以在64位进程中分配的虚拟内存量仅受操作系统提供将虚拟内存映射到RAM的页面的限制。 Which is normally only limited by the largest allowed paging file, assuming you didn't create your own mapping with CreateFileMapping(). 这通常仅受最大允许分页文件的限制,假设您没有使用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. Windows版本有一个上限,Windows 7 Home Premium为16 GB,Professional和up为192 GB。

RAM is only used when your program actually accesses the virtual memory. RAM仅在程序实际访问虚拟内存时使用。 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. 如果在使用所有可用页面之前分配和使用内存大大超出RAM量,则64位进程通常会因为这些页面错误而变慢。

Since you are considerably South of the typical maximum paging file size, this is surely just another plain old heap corruption bug. 由于您是典型的最大页面文件大小的南方,这肯定只是另一个普通的旧堆损坏错误。

Debug your program. 调试你的程序。 Crashing isn't supposed to happen just because you allocate a lot of memory. 不应该仅因为你分配了大量内存而发生崩溃。 The usual suspects: math overflows, memory corruptions, failure to handle errors from memory-allocating routines. 通常的怀疑:数学溢出,内存损坏,无法处理内存分配例程中的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM