From 3c9fe1041a7c33d212cae28e492db69838b4d6af Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 8 May 2019 17:10:53 +0100 Subject: [PATCH] Added error message to Windows Pal using VirtualAlloc. (#44) --- src/pal/pal_windows.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pal/pal_windows.h b/src/pal/pal_windows.h index 611ddff..5a3d4ab 100644 --- a/src/pal/pal_windows.h +++ b/src/pal/pal_windows.h @@ -217,7 +217,12 @@ namespace snmalloc if (committed) flags |= MEM_COMMIT; - return VirtualAlloc(nullptr, *size, flags, PAGE_READWRITE); + void* ret = VirtualAlloc(nullptr, *size, flags, PAGE_READWRITE); + if (ret == nullptr) + { + error("Failed to allocate memory\n"); + } + return ret; } # endif };