diff options
author | Simon Marlow <marlowsd@gmail.com> | 2010-08-20 09:31:33 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2010-08-20 09:31:33 +0000 |
commit | d63ba79a6dde7a5616d3b532589ff09d3820f794 (patch) | |
tree | 895f26c780540bebfd5bda6f9ab1df82c61679b3 /rts/sm | |
parent | fa13a9b184b69258004e24b4fa2f96e961f2a66d (diff) | |
download | haskell-d63ba79a6dde7a5616d3b532589ff09d3820f794.tar.gz |
fix some shutdown memory leaks
Diffstat (limited to 'rts/sm')
-rw-r--r-- | rts/sm/MBlock.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c index 53172753f1..b9d71f68c9 100644 --- a/rts/sm/MBlock.c +++ b/rts/sm/MBlock.c @@ -88,10 +88,11 @@ setHeapAlloced(void *p, StgWord8 i) if(map == NULL) { mblock_map_count++; - mblock_maps = realloc(mblock_maps, - sizeof(MBlockMap*) * mblock_map_count); + mblock_maps = stgReallocBytes(mblock_maps, + sizeof(MBlockMap*) * mblock_map_count, + "markHeapAlloced(1)"); map = mblock_maps[mblock_map_count-1] = - stgMallocBytes(sizeof(MBlockMap),"markHeapAlloced"); + stgMallocBytes(sizeof(MBlockMap),"markHeapAlloced(2)"); memset(map,0,sizeof(MBlockMap)); map->addrHigh32 = (StgWord32) (((StgWord)p) >> 32); } @@ -264,8 +265,16 @@ freeMBlocks(void *addr, nat n) void freeAllMBlocks(void) { + nat n; + debugTrace(DEBUG_gc, "freeing all megablocks"); + osFreeAllMBlocks(); + + for (n = 0; n < mblock_map_count; n++) { + stgFree(mblock_maps[n]); + } + stgFree(mblock_maps); } void |