• Tamar Christina's avatar
    rts: fix Windows megablock allocator · 676f1f2d
    Tamar Christina authored
    The megablock allocator does not currently check that after aligning the
    free region if it still has enough space to actually do the allocation.
    This causes it to return a memory region which it didn't fully allocate
    itself.  Even worse, it can cause it to return a block with a region
    that will be present in two allocation pools.
    This causes if you're lucky an error from the OS that you're committing
    memory that has never been reserved, or causes random heap corruption.
    This change makes it consider the alignment as well.
    Test Plan: ./validate , testcase testmblockalloc
    Reviewers: bgamari, erikd, simonmar
    Reviewed By: simonmar
    Subscribers: rwbarton, carter
    Differential Revision: https://phabricator.haskell.org/D5363
OSMem.c 17.1 KB