rts/Hash.c
/* -----------------------------------------------------------------------------
 * We allocate the hashlist cells in large chunks to cut down on malloc
 * overhead.  Although we keep a free list of hashlist cells, we make
 * no effort to actually return the space to the malloc arena.
 * -------------------------------------------------------------------------- */
We allocate the hashlist cells in large chunks to cut down on malloc
overhead.  Although we keep a free list of hashlist cells, we make
no effort to actually return the space to the malloc arena.
We allocate the hashlist cells in large chunks to cut down on malloc overhead . Although we keep a free list of hashlist cells we make no effort to actually return the space to the malloc arena .
static HashList *
allocHashList (HashTable *table)
{
    HashList *hl, *p;
    HashListChunk *cl;
    if ((hl = table->freeList) != NULL) {
        table->freeList = hl->next;
    } else {
        hl = stgMallocBytes(HCHUNK * sizeof(HashList), "allocHashList");
        cl = stgMallocBytes(sizeof (*cl), "allocHashList: chunkList");
        cl->chunk = hl;
        cl->next = table->chunks;
        table->chunks = cl;
        table->freeList = hl + 1;
        for (p = table->freeList; p < hl + HCHUNK - 1; p++)
            p->next = p + 1;
        p->next = NULL;
    }
    return hl;
}
static HashList * allocHashList ( HashTable * table ) { HashList * hl , * p ; HashListChunk * cl ; if ( ( hl = table -> freeList ) != NULL ) { table -> freeList = hl -> next ; } else { hl = stgMallocBytes ( HCHUNK * sizeof ( HashList ) , " " ) ; cl = stgMallocBytes ( sizeof ( * cl ) , " " ) ; cl -> chunk = hl ; cl -> next = table -> chunks ; table -> chunks = cl ; table -> freeList = hl + 1 ; for ( p = table -> freeList ; p < hl + HCHUNK - 1 ; p ++ ) p -> next = p + 1 ; p -> next = NULL ; } return hl ; }
We allocate the hashlist cells in large chunks to cut down on malloc
 overhead.
We allocate the hashlist cells in large chunks to cut down on malloc overhead .