mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 17:19:36 +00:00
Do not try to use large pages on 32 bit Windows.
verified to work on windows XP. fixes #3379 closes https://github.com/official-stockfish/Stockfish/pull/3380 No functional change.
This commit is contained in:
parent
7ffae17f85
commit
d4b864ff12
1 changed files with 6 additions and 1 deletions
|
@ -362,7 +362,7 @@ void std_aligned_free(void* ptr) {
|
|||
/// aligned_large_pages_alloc() will return suitably aligned memory, if possible using large pages.
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#if defined(_WIN64)
|
||||
static void* aligned_large_pages_alloc_win(size_t allocSize) {
|
||||
|
||||
HANDLE hProcessToken { };
|
||||
|
@ -407,15 +407,20 @@ static void* aligned_large_pages_alloc_win(size_t allocSize) {
|
|||
|
||||
return mem;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* aligned_large_pages_alloc(size_t allocSize) {
|
||||
|
||||
#if defined(_WIN64)
|
||||
// Try to allocate large pages
|
||||
void* mem = aligned_large_pages_alloc_win(allocSize);
|
||||
|
||||
// Fall back to regular, page aligned, allocation if necessary
|
||||
if (!mem)
|
||||
mem = VirtualAlloc(NULL, allocSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
#else
|
||||
void* mem = VirtualAlloc(NULL, allocSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
#endif
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue