def test_malloc(op):
    count = 0
    start = datetime.now()
    only_op = tracemalloc.Filter(True, __file__, lineno=102, all_frames=True)
    tracemalloc.start(10)
    try:
        op()
        before = tracemalloc.take_snapshot().filter_traces([only_op])
        while True:
            count += 1
            op()
            if ((datetime.now() - start) > timedelta(seconds=0.2)):
                break
        after = tracemalloc.take_snapshot().filter_traces([only_op])
        diff = after.compare_to(before, 'traceback')
        diff = [entry for entry in diff if (entry.size_diff > 0)]
        return (count, diff)
    finally:
        tracemalloc.stop()
def test_malloc(op):
    count = 0
    start = datetime.now()
    only_op = tracemalloc.Filter(True, __file__, lineno=102, all_frames=True)
    tracemalloc.start(10)
    try:
        op()
        before = tracemalloc.take_snapshot().filter_traces([only_op])
        while True:
            count += 1
            op()
            if ((datetime.now() - start) > timedelta(seconds=0.2)):
                break
        after = tracemalloc.take_snapshot().filter_traces([only_op])
        diff = after.compare_to(before, 'traceback')
        diff = [entry for entry in diff if (entry.size_diff > 0)]
        return (count, diff)
    finally:
        tracemalloc.stop()