mirror of
https://github.com/isar/libmdbx.git
synced 2025-11-06 06:18:56 +08:00
mdbx: refine discarding of unused pages (MADV_FREE/MADV_REMOVE/MADV_DONTNEED).
Change-Id: I657eb7ef9060214d6ed3d75a2deeebc9ff3df5f5
This commit is contained in:
@@ -689,12 +689,14 @@ MDBX_srwlock_function mdbx_srwlock_Init, mdbx_srwlock_AcquireShared,
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#if 0 /* LY: unused for now */
|
||||
static DWORD WINAPI stub_DiscardVirtualMemory(PVOID VirtualAddress,
|
||||
SIZE_T Size) {
|
||||
return VirtualAlloc(VirtualAddress, Size, MEM_RESET, PAGE_NOACCESS)
|
||||
? ERROR_SUCCESS
|
||||
: GetLastError();
|
||||
}
|
||||
#endif /* unused for now */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#ifndef MDBX_ALLOY
|
||||
@@ -702,9 +704,13 @@ MDBX_GetFileInformationByHandleEx mdbx_GetFileInformationByHandleEx;
|
||||
MDBX_GetVolumeInformationByHandleW mdbx_GetVolumeInformationByHandleW;
|
||||
MDBX_GetFinalPathNameByHandleW mdbx_GetFinalPathNameByHandleW;
|
||||
MDBX_SetFileInformationByHandle mdbx_SetFileInformationByHandle;
|
||||
MDBX_PrefetchVirtualMemory mdbx_PrefetchVirtualMemory;
|
||||
MDBX_DiscardVirtualMemory mdbx_DiscardVirtualMemory;
|
||||
MDBX_NtFsControlFile mdbx_NtFsControlFile;
|
||||
MDBX_PrefetchVirtualMemory mdbx_PrefetchVirtualMemory;
|
||||
#if 0 /* LY: unused for now */
|
||||
MDBX_DiscardVirtualMemory mdbx_DiscardVirtualMemory;
|
||||
MDBX_OfferVirtualMemory mdbx_OfferVirtualMemory;
|
||||
MDBX_ReclaimVirtualMemory mdbx_ReclaimVirtualMemory;
|
||||
#endif /* unused for now */
|
||||
#endif /* MDBX_ALLOY */
|
||||
|
||||
static void mdbx_winnt_import(void) {
|
||||
@@ -736,9 +742,13 @@ static void mdbx_winnt_import(void) {
|
||||
GET_KERNEL32_PROC(GetFinalPathNameByHandleW);
|
||||
GET_KERNEL32_PROC(SetFileInformationByHandle);
|
||||
GET_KERNEL32_PROC(PrefetchVirtualMemory);
|
||||
#if 0 /* LY: unused for now */
|
||||
GET_KERNEL32_PROC(DiscardVirtualMemory);
|
||||
if (!mdbx_DiscardVirtualMemory)
|
||||
mdbx_DiscardVirtualMemory = stub_DiscardVirtualMemory;
|
||||
GET_KERNEL32_PROC(OfferVirtualMemory);
|
||||
GET_KERNEL32_PROC(ReclaimVirtualMemory);
|
||||
#endif /* unused for now */
|
||||
#undef GET_KERNEL32_PROC
|
||||
|
||||
const HINSTANCE hNtdll = GetModuleHandleA("ntdll.dll");
|
||||
|
||||
Reference in New Issue
Block a user