def memoryit(group_by='lineno', limit=10):
    """
    追踪函数内存消耗情况

    :param group_by: 统计分组，有 'filename', 'lineno', 'traceback' 可选
    :param limit: 限制输出行数
    """
    def wrapper(func):
        @wraps(func)
        def inner(*args, **kwargs):
            tracemalloc.start()
            _start = tracemalloc.take_snapshot()
            _result = func(*args, **kwargs)
            _end = tracemalloc.take_snapshot()
            stats = _end.compare_to(_start, group_by)
            _print(stats, limit, func.__name__ + '()')
            return _result
        return inner
    return wrapper
def memoryit(group_by='lineno', limit=10):
    """
    追踪函数内存消耗情况

    :param group_by: 统计分组，有 'filename', 'lineno', 'traceback' 可选
    :param limit: 限制输出行数
    """
    def wrapper(func):
        @wraps(func)
        def inner(*args, **kwargs):
            tracemalloc.start()
            _start = tracemalloc.take_snapshot()
            _result = func(*args, **kwargs)
            _end = tracemalloc.take_snapshot()
            stats = _end.compare_to(_start, group_by)
            _print(stats, limit, func.__name__ + '()')
            return _result
        return inner
    return wrapper
def memoryit ( group_by = 'lineno' , limit = 10 ) : def wrapper ( func ) : @ wraps ( func ) def inner ( * args , * * kwargs ) : tracemalloc . start ( ) _start = tracemalloc . take_snapshot ( ) _result = func ( * args , * * kwargs ) _end = tracemalloc . take_snapshot ( ) stats = _end . compare_to ( _start , group_by ) _print ( stats , limit , func . __name__ + '()' ) return _result return inner return wrapper
追踪函数内存消耗情况

    :param group_by: 统计分组，有 'filename', 'lineno', 'traceback' 可选
    :param limit: 限制输出行数
追踪函数内存消耗情况