mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
win32: allow heap cache optimization and memory decommit
This commit is contained in:
parent
4f2a12110f
commit
7f7513132f
@ -9,6 +9,18 @@
|
||||
#include "osdep/terminal.h"
|
||||
#include "osdep/main-fn.h"
|
||||
|
||||
#ifndef HEAP_OPTIMIZE_RESOURCES_CURRENT_VERSION
|
||||
|
||||
#define HEAP_OPTIMIZE_RESOURCES_CURRENT_VERSION 1
|
||||
enum { HeapOptimizeResources = 3 };
|
||||
|
||||
struct HEAP_OPTIMIZE_RESOURCES_INFORMATION {
|
||||
DWORD Version;
|
||||
DWORD Flags;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
static bool is_valid_handle(HANDLE h)
|
||||
{
|
||||
return h != INVALID_HANDLE_VALUE && h != NULL &&
|
||||
@ -30,6 +42,13 @@ static void microsoft_nonsense(void)
|
||||
// Enable heap corruption detection
|
||||
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
|
||||
|
||||
// Allow heap cache optimization and memory decommit
|
||||
struct HEAP_OPTIMIZE_RESOURCES_INFORMATION heap_info = {
|
||||
.Version = HEAP_OPTIMIZE_RESOURCES_CURRENT_VERSION
|
||||
};
|
||||
HeapSetInformation(NULL, HeapOptimizeResources, &heap_info,
|
||||
sizeof(heap_info));
|
||||
|
||||
// Always use safe search paths for DLLs and other files, ie. never use the
|
||||
// current directory
|
||||
SetDllDirectoryW(L"");
|
||||
|
Loading…
Reference in New Issue
Block a user