0vercl0k / lockmem

This utility allows you to lock every available memory regions of an arbitrary process into its working set.
MIT License
64 stars 14 forks source link
virtual-memory-management windows working-set

lockmem

Builds

This utility allows you to lock every available memory regions of an arbitrary process into its working set. It uses ntdll!NtLockVirtualMemory (syscall used internally by VirtualLock) to lock memory ranges as well as GetProcessWorkingSetSizeEx and SetProcessWorkingSetSizeEx to increase the size of the process' working set.

The Windows kernel guarantees that those pages will stay resident in memory, not written to the pagefile and not incur a page fault on access.

lockmem

Build

(base) c:\lockmem\src>nmake

Microsoft (R) Program Maintenance Utility Version 14.26.28806.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        if not exist ..\bin mkdir ..\bin
        cl /O1 /nologo /ZI /W3 /D_AMD64_ /DWIN_X64 /sdl /Fe..\bin\lockmem.exe lockmem.cc /link /nologo /debug:full ntdll.lib
lockmem.cc
        del *.obj *.pdb *.idb
        if exist .\bin del bin\*.exp bin\*.ilk bin\*.lib

(base) c:\lockmem\src>..\bin\lockmem.exe
./lockme <process name | pid>