示例#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"
示例#2
0
文件: test00.py 项目: hroest/autowrap
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"
示例#3
0
def show_mem(label):

    p = free_mem()
    p /= 1024.0 * 1024
    print(label + " ").ljust(50, "."), ": %8.2f MB" % p
    sys.stdout.flush()
示例#4
0
文件: test00.py 项目: hroest/autowrap
def show_mem(label):

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