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?
views:
110answers:
4Hi you can set the windows option of lock pages in memory. Usually this setting is mostly used by SQL Server, but works also for other applications. Check this site on msdn
enable addressing windows extensions (AWE) for your application. See this link on 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.
You can try http://gnuwin32.sourceforge.net to (try to) avoid porting, in case this is what you are doing.
I have to ask, why do you need to do this? If every app thought its pages were so important that they shouldn't be paged out ever, it would be a giant waste of memory.
If the pages are in use, they won't be sent to the pagefile, and if they're not in use, why keep them around? Trust in Mm, it was written by a very smart guy :)