X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fsm%2FStorage.c;h=097c727ca7e9f0adc1d86e3dacf52072cfa29c83;hb=ca5ded310c0a596be199a3da5f14be2fb2020687;hp=ddae8c6bd68bb22cf7494564c2f200982f947bef;hpb=7cca410a40cccf0fbeda2155f307baa5619b8130;p=ghc-hetmet.git diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index ddae8c6..097c727 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -287,6 +287,7 @@ freeStorage (void) #if defined(THREADED_RTS) closeMutex(&sm_mutex); closeMutex(&atomic_modify_mutvar_mutex); + stgFree(nurseries); #endif } @@ -1045,20 +1046,17 @@ void freeExec (void *addr) bd->gen_no -= *(StgPtr)p; *(StgPtr)p = 0; - // Free the block if it is empty, but not if it is the block at - // the head of the queue. - if (bd->gen_no == 0 && bd != exec_block) { - debugTrace(DEBUG_gc, "free exec block %p", bd->start); - if (bd->u.back) { - bd->u.back->link = bd->link; - } else { - exec_block = bd->link; - } - if (bd->link) { - bd->link->u.back = bd->u.back; - } - setExecutable(bd->start, bd->blocks * BLOCK_SIZE, rtsFalse); - freeGroup(bd); + if (bd->gen_no == 0) { + // Free the block if it is empty, but not if it is the block at + // the head of the queue. + if (bd != exec_block) { + debugTrace(DEBUG_gc, "free exec block %p", bd->start); + dbl_link_remove(bd, &exec_block); + setExecutable(bd->start, bd->blocks * BLOCK_SIZE, rtsFalse); + freeGroup(bd); + } else { + bd->free = bd->start; + } } RELEASE_SM_LOCK @@ -1186,7 +1184,7 @@ memInventory(void) debugBelch(" exec : %4lu\n", exec_blocks); debugBelch(" free : %4lu\n", free_blocks); debugBelch(" total : %4lu\n\n", live_blocks + free_blocks); - debugBelch(" in system : %4lu\n", mblocks_allocated + BLOCKS_PER_MBLOCK); + debugBelch(" in system : %4lu\n", mblocks_allocated * BLOCKS_PER_MBLOCK); ASSERT(0); } }