Skip to content

Commit

Permalink
Replace LoadLibrary+GetProcAddress to direct call (HeapSetInformation).
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Jan 29, 2016
1 parent 0c84242 commit d88ad80
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/xrEngine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,27 +448,16 @@ int APIENTRY WinMain_impl(HINSTANCE hInstance,

if (!IsDebuggerPresent())
{

HMODULE const kernel32 = LoadLibrary("kernel32.dll");
R_ASSERT(kernel32);

typedef BOOL(__stdcall*HeapSetInformation_type) (HANDLE, HEAP_INFORMATION_CLASS, PVOID, SIZE_T);
HeapSetInformation_type const heap_set_information =
(HeapSetInformation_type)GetProcAddress(kernel32, "HeapSetInformation");
if (heap_set_information)
{
ULONG HeapFragValue = 2;
ULONG HeapFragValue = 2;
#ifdef DEBUG
BOOL const result =
BOOL const result =
#endif // #ifdef DEBUG
heap_set_information(
GetProcessHeap(),
HeapCompatibilityInformation,
&HeapFragValue,
sizeof(HeapFragValue)
);
VERIFY2(result, "can't set process heap low fragmentation");
}
HeapSetInformation(
GetProcessHeap(),
HeapCompatibilityInformation,
&HeapFragValue,
sizeof(HeapFragValue));
VERIFY2(result, "can't set process heap low fragmentation");
}
#ifndef DEDICATED_SERVER
// Check for another instance
Expand Down

0 comments on commit d88ad80

Please sign in to comment.