X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fsm%2FStorage.c;h=f9e32f288a93989b72afc05834726999be5e301e;hb=0981e24e9980b8b26e6f20fc56bebc1c7416cc4f;hp=fba30bbc16f4d8ef816ce37508d70ec4ba4599ad;hpb=d12cd2f2c930773a34781b942b8248a3818eeae8;p=ghc-hetmet.git diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index fba30bb..f9e32f2 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -115,6 +115,8 @@ initStorage( void ) return; } + initMBlocks(); + /* Sanity check to make sure the LOOKS_LIKE_ macros appear to be * doing something reasonable. */ @@ -287,6 +289,7 @@ freeStorage (void) #if defined(THREADED_RTS) closeMutex(&sm_mutex); closeMutex(&atomic_modify_mutvar_mutex); + stgFree(nurseries); #endif } @@ -1045,20 +1048,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