static void initMBlock(void *mblock);
-// The free_list is kept sorted by size, smallest first.
-// In THREADED_RTS mode, the free list is protected by sm_mutex.
-
/* -----------------------------------------------------------------------------
Implementation notes
~~~~~~~~~~
Preliminaries:
- - most allocations are for small blocks
+ - most allocations are for a small number of blocks
- sometimes the OS gives us new memory backwards in the address
space, sometimes forwards, so we should not be biased towards
any particular layout in the address space
#define MAX_FREE_LIST 9
+// In THREADED_RTS mode, the free list is protected by sm_mutex.
+
static bdescr *free_list[MAX_FREE_LIST];
static bdescr *free_mblock_list;
if (best)
{
// we take our chunk off the end here.
- nat best_mblocks = BLOCKS_TO_MBLOCKS(best->blocks);
+ StgWord best_mblocks = BLOCKS_TO_MBLOCKS(best->blocks);
bd = FIRST_BDESCR((StgWord8*)MBLOCK_ROUND_DOWN(best) +
(best_mblocks-mblocks)*MBLOCK_SIZE);