1
0
forked from 0ad/0ad

Removes LowFragmentationHeap from Windows as it's enabled by default since Vista.

Differential Revision: https://code.wildfiregames.com/D5048
This was SVN commit r27720.
This commit is contained in:
Vladislav Belov 2023-06-18 16:34:29 +00:00
parent f8798c2245
commit 54c606e6aa

View File

@ -255,31 +255,6 @@ static void FreeDirectories()
wutil_Free(personalPath);
}
//-----------------------------------------------------------------------------
// memory
static void EnableLowFragmentationHeap()
{
if(IsDebuggerPresent())
{
// and the debug heap isn't explicitly disabled,
char* var = getenv("_NO_DEBUG_HEAP");
if(!var || var[0] != '1')
return; // we can't enable the LFH
}
#if WINVER >= 0x0501
WUTIL_FUNC(pHeapSetInformation, BOOL, (HANDLE, HEAP_INFORMATION_CLASS, void*, size_t));
WUTIL_IMPORT_KERNEL32(HeapSetInformation, pHeapSetInformation);
if(pHeapSetInformation)
{
ULONG flags = 2; // enable LFH
pHeapSetInformation(GetProcessHeap(), HeapCompatibilityInformation, &flags, sizeof(flags));
}
#endif // #if WINVER >= 0x0501
}
//-----------------------------------------------------------------------------
Status wutil_SetPrivilege(const wchar_t* privilege, bool enable)
@ -393,8 +368,6 @@ static Status wutil_Init()
{
InitLocks();
EnableLowFragmentationHeap();
GetDirectories();
return INFO::OK;