且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

远离虚拟内存在Windows\C ++

更新时间:2023-01-15 21:39:54

即使您能够停止应用程序将内存分页到磁盘,您仍然会遇到问题,VMM可能会调出其他程序到磁盘,并可能会影响您的性能。更不用说另一个应用程序可能会启动并消耗您当前占用的内存,从而导致您的一些应用程序内存被分页。您计划如何处理这个问题?

Even if you're able to stop your application from having memory paged out to disk, you'll still run into the problem that the VMM might be paging out other programs to disk and that might potentially affect your performance as well. Not to mention that another application might start up and consume memory that you're currently occupying and thus resulting in some of your applications memory being paged out. How are you planning to deal with that?

有一种方法可以通过非分页池,但(a)这个池比较小,(b)它被设备驱动程序使用,并且可能只可以从内核使用。它也不是真的建议使用它的大块,除非你想确保你的系统是不稳定。

There is a way to use non-pageable memory via the non-paged pool but (a) this pool is comparatively small and (b) it's used by device drivers and might only be usable from inside the kernel. It's also not really recommended to use large chunks of it unless you want to make sure your system isn't that stable.

你可能想重新访问你的应用程序的设计并尝试解决将内存分页到磁盘的可能性,然后尝试编写自己的VMM或将Windows机器转换为基本上具有更多内存的DOS框。

You might want to revisit the design of your application and try to work around the possibility of having memory paged to disk before you either try to write your own VMM or turn a Windows machine into essentially a DOS box with more memory.