Skip to content

tracemalloc backend broken for memory_usage #402

@ilan-gold

Description

@ilan-gold
from memory_profiler import memory_usage
memory_usage(lambda _: x, backend="tracemalloc")

gives

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ilangold/Projects/Theis/anndata/benchmarks/venv_mem/lib/python3.12/site-packages/memory_profiler.py", line 369, in memory_usage
    p = MemTimer(os.getpid(), interval, child_conn, backend,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilangold/Projects/Theis/anndata/benchmarks/venv_mem/lib/python3.12/site-packages/memory_profiler.py", line 244, in __init__
    _get_memory(self.monitor_pid, self.backend, timestamps=self.timestamps,
  File "/Users/ilangold/Projects/Theis/anndata/benchmarks/venv_mem/lib/python3.12/site-packages/memory_profiler.py", line 212, in _get_memory
    raise RuntimeError(
RuntimeError: There is no access to source file of the profiled function

Env:

memory-profiler==0.61.0
Python 3.12.3 [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions