如何使用WinAPI的锁定内存页? [英] How to lock pages in memory using WinAPI?

查看:214
本文介绍了如何使用WinAPI的锁定内存页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要prevent应用程序的内存页被换出的内存在Windows上。是否有一个WinAPI的功能相当于POSIX mlockall用于()的 实现呢?​​

I need to prevent application's memory pages from being swapped out of RAM on Windows. Is there a WinAPI function equivalent of POSIX mlockall() to achieve that?

推荐答案

是,VirtualLock()。有一个关于你多少页锁的限制,就不能养猪RAM。细节是 MSDN文章。

Yes, VirtualLock(). There's a limit on how many pages you can lock, you can't hog RAM. Details are in the MSDN article.

这篇关于如何使用WinAPI的锁定内存页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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