Skip to content

Commit d4b864f

Browse files
noobpwnftwvondele
authored andcommitted
Do not try to use large pages on 32 bit Windows.
verified to work on windows XP. fixes #3379 closes #3380 No functional change.
1 parent 7ffae17 commit d4b864f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/misc.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void std_aligned_free(void* ptr) {
362362
/// aligned_large_pages_alloc() will return suitably aligned memory, if possible using large pages.
363363

364364
#if defined(_WIN32)
365-
365+
#if defined(_WIN64)
366366
static void* aligned_large_pages_alloc_win(size_t allocSize) {
367367

368368
HANDLE hProcessToken { };
@@ -407,15 +407,20 @@ static void* aligned_large_pages_alloc_win(size_t allocSize) {
407407

408408
return mem;
409409
}
410+
#endif
410411

411412
void* aligned_large_pages_alloc(size_t allocSize) {
412413

414+
#if defined(_WIN64)
413415
// Try to allocate large pages
414416
void* mem = aligned_large_pages_alloc_win(allocSize);
415417

416418
// Fall back to regular, page aligned, allocation if necessary
417419
if (!mem)
418420
mem = VirtualAlloc(NULL, allocSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
421+
#else
422+
void* mem = VirtualAlloc(NULL, allocSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
423+
#endif
419424

420425
return mem;
421426
}

0 commit comments

Comments
 (0)