Index: runtime/vm/virtual_memory_win.cc |
diff --git a/runtime/vm/virtual_memory_win.cc b/runtime/vm/virtual_memory_win.cc |
index 25846136a996007789204103b8fc3aba808b33ed..f50d78fb718af3930a81929281180b8a797e39db 100644 |
--- a/runtime/vm/virtual_memory_win.cc |
+++ b/runtime/vm/virtual_memory_win.cc |
@@ -39,16 +39,16 @@ VirtualMemory::~VirtualMemory() { |
return; |
} |
if (VirtualFree(address(), 0, MEM_RELEASE) == 0) { |
- FATAL("VirtualFree failed"); |
+ FATAL1("VirtualFree failed: Error code %d\n", GetLastError()); |
} |
} |
bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) { |
- // On Windows only the entire segment returned by VirtualAlloc |
- // can be freed. Therefore we will have to waste these unused |
- // virtual memory sub-segments. |
- return false; |
+ if (VirtualFree(address, size, MEM_DECOMMIT) == 0) { |
+ FATAL1("VirtualFree failed: Error code %d\n", GetLastError()); |
+ } |
+ return true; |
} |