def process_memory(to_mb=False):
    """
    Return the memory usage of current process. The unit is byte by default.
    """
    import psutil
    import os
    process = psutil.Process(os.getpid())
    mem_info = process.memory_info()
    if to_mb:
        return mem_info.rss / (1024**2)
    else:
        return mem_info.rss

    Return the memory usage of current process. The unit is byte by default.
    
metadrive/tests/test_functionality/test_memory_leak_engine.py