diff options
author | Esa Ilari Vuokko <ei@vuokko.info> | 2006-08-30 18:55:40 +0000 |
---|---|---|
committer | Esa Ilari Vuokko <ei@vuokko.info> | 2006-08-30 18:55:40 +0000 |
commit | db76a303650647c24a9a3f998dbe66e1d1623a1c (patch) | |
tree | e3b60d9a00c9d75eac665fc96f2a2909923638e8 | |
parent | 47f59de5d2f5e7573dbf4a335d52da9fa1c3e23d (diff) | |
download | haskell-db76a303650647c24a9a3f998dbe66e1d1623a1c.tar.gz |
Fix Windows MBlock alloctor bookkeeping bug
-rw-r--r-- | rts/MBlock.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/rts/MBlock.c b/rts/MBlock.c index 9058205716..edde679992 100644 --- a/rts/MBlock.c +++ b/rts/MBlock.c @@ -340,16 +340,16 @@ allocNew(nat n) { sysErrorBelch( "getMBlocks: VirtualAlloc MEM_RESERVE %d blocks failed", n); } else { - if(allocs==0) { - allocs=rec; - rec->next=0; - } else { - alloc_rec* it; - it=allocs; - for(; it->next!=0 && it->next->base<rec->base; it=it->next) ; - rec->next=it->next; - it->next=rec; - } + alloc_rec temp; + temp.base=0; temp.size=0; temp.next=allocs; + + alloc_rec* it; + it=&temp; + for(; it->next!=0 && it->next->base<rec->base; it=it->next) ; + rec->next=it->next; + it->next=rec; + + allocs=temp.next; debugTrace(DEBUG_gc, "allocated %d megablock(s) at 0x%x",n,(nat)rec->base); } return rec; |