Ejemplo n.º 1
0
def test_free():
    h = Heap()

    addr1, block1, c1ptr = allocate_raw(h, 5)
    addr2, block2, c2ptr = allocate_raw(h, 5)

    assert len(h._arenas) == 1
    h.free(block2)

    addr3, block2, c2ptr = allocate_raw(h, 5)

    # Blocks get merged when free'd so that align blocks
    assert addr3 == addr2
Ejemplo n.º 2
0
def test_free():
    h = Heap()

    addr1, block1, c1ptr = allocate_raw(h, 5)
    addr2, block2, c2ptr = allocate_raw(h, 5)

    assert len(h._arenas) == 1
    h.free(block2)

    addr3, block2, c2ptr = allocate_raw(h, 5)

    # Blocks get merged when free'd so that align blocks
    assert addr3 == addr2
Ejemplo n.º 3
0
def test_malloc():
    h = Heap()
    _, block, _ = allocate_raw(h, 1000)
Ejemplo n.º 4
0
def test_malloc():
    h = Heap()
    _, block, _ = allocate_raw(h, 1000)