diff options
author | Simon Marlow <simonmar@microsoft.com> | 2006-08-30 09:18:59 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2006-08-30 09:18:59 +0000 |
commit | 7ee5c6affd10895ddc3b1e09550069391faaa40a (patch) | |
tree | f06928001dcbe32de2495523d0a320a1baf13e43 /rts/MBlock.c | |
parent | ed92004880e4a79457338edfe993f968360fbbfd (diff) | |
download | haskell-7ee5c6affd10895ddc3b1e09550069391faaa40a.tar.gz |
Windows: make some soft failures into fatal errors
Some of the memory allocation calls were being checked for error, but
the RTS was printing a message and continuing. These error cases
lead to crashes later, so better to just fail immediately.
Diffstat (limited to 'rts/MBlock.c')
-rw-r--r-- | rts/MBlock.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/rts/MBlock.c b/rts/MBlock.c index f317690d4c..15a4d2300e 100644 --- a/rts/MBlock.c +++ b/rts/MBlock.c @@ -450,8 +450,10 @@ commitBlocks(char* base, int size) { size_delta = it->size - (base-it->base); if(size_delta>size) size_delta=size; temp = VirtualAlloc(base, size_delta, MEM_COMMIT, PAGE_READWRITE); - if(temp==0) - debugBelch("getMBlocks: VirtualAlloc MEM_COMMIT failed: %ld", GetLastError()); + if(temp==0) { + errorBelch("getMBlocks: VirtualAlloc MEM_COMMIT failed: %ld\n", GetLastError()); + stg_exit(EXIT_FAILURE); + } size-=size_delta; base+=size_delta; } @@ -465,10 +467,12 @@ getMBlocks(nat n) { alloc_rec* alloc; alloc = allocNew(n); /* We already belch in allocNew if it fails */ - if(alloc!=0) { + if (alloc == 0) { + stg_exit(EXIT_FAILURE); + } else { insertFree(alloc->base, alloc->size); ret = findFreeBlocks(n); - } + } } if(ret!=0) { @@ -511,7 +515,8 @@ freeAllMBlocks(void) it=allocs; for(; it!=0; ) { if(!VirtualFree((void*)it->base, 0, MEM_RELEASE)) { - debugBelch("freeAllMBlocks: VirtualFree MEM_RELEASE failed with %ld", GetLastError()); + errorBelch("freeAllMBlocks: VirtualFree MEM_RELEASE failed with %ld", GetLastError()); + stg_exit(EXIT_FAILURE); } next = it->next; stgFree(it); |