Esempio n. 1
0
def MemTester(name, use_assert=False):
    mem_at_start = free_mem()
    print
    show_mem("start test '%s' with" % name)
    yield
    missing = mem_at_start - free_mem()
    show_mem("end with")
    print
    if use_assert:
        assert missing < 0.1 * mem_at_start, "possible mem leak"
Esempio n. 2
0
def MemTester(name, use_assert=False):
        mem_at_start = free_mem()
        print
        show_mem("start test '%s' with" % name)
        yield
        missing = mem_at_start - free_mem()
        show_mem("end with")
        print
        if use_assert:
            assert missing < 0.1* mem_at_start, "possible mem leak"
Esempio n. 3
0
def show_mem(label):

    p = free_mem()
    p /= 1024.0 * 1024
    print(label + " ").ljust(50, "."), ": %8.2f MB" % p
    sys.stdout.flush()
Esempio n. 4
0
def show_mem(label):

    p = free_mem()
    p /= 1024.0 * 1024
    print (label+" ").ljust(50, "."), ": %8.2f MB" % p
    sys.stdout.flush()