• Ben Gamari's avatar
    rts/Hash: Simplify freeing of HashListChunks · a788d4d1
    Ben Gamari authored
    While looking at #18348 I noticed that the treatment of HashLists are a
    bit more complex than necessary (which lead to some initial confusion on
    my part). Specifically, we allocate HashLists in chunks. Each chunk
    allocation makes two allocations: one for the chunk itself and one for a
    HashListChunk to link together the chunks for the purposes of freeing.
    Simplify this (and hopefully make the relationship between these
    clearer) but allocating the HashLists and HashListChunk in a single
    malloc. This will both make the implementation easier to follow and
    reduce C heap fragmentation.
    Note that even after this patch we fail to bound the size of the free
    HashList pool. However, this is a separate bug.
Hash.c 15.3 KB