summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2007-08-30 13:51:46 +0000
committerSimon Marlow <simonmar@microsoft.com>2007-08-30 13:51:46 +0000
commit51a1bbab96f8795701fc59d295a5f556cfbf5622 (patch)
treef79a9d1bdf38a3f3ff46e90c766d5356e8e92245
parentf64384c40b3db4fddb8fad5463da39464e52ab13 (diff)
downloadhaskell-51a1bbab96f8795701fc59d295a5f556cfbf5622.tar.gz
Windows: give a better error message when running out of memory
I think this fixes #1209 Previously: outofmem.exe: getMBlocks: VirtualAlloc MEM_RESERVE 1025 blocks failed: Not enoug h storage is available to process this command. Now: outofmem.exe: out of memory
-rw-r--r--rts/sm/MBlock.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c
index 601387cf80..54d414807a 100644
--- a/rts/sm/MBlock.c
+++ b/rts/sm/MBlock.c
@@ -348,8 +348,13 @@ allocNew(nat n) {
if(rec->base==0) {
stgFree((void*)rec);
rec=0;
- sysErrorBelch(
- "getMBlocks: VirtualAlloc MEM_RESERVE %d blocks failed", n);
+ if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) {
+
+ errorBelch("out of memory");
+ } else {
+ sysErrorBelch(
+ "getMBlocks: VirtualAlloc MEM_RESERVE %d blocks failed", n);
+ }
} else {
alloc_rec temp;
temp.base=0; temp.size=0; temp.next=allocs;