bloomberg / memray

Memray is a memory profiler for Python
https://bloomberg.github.io/memray/
Apache License 2.0
13.17k stars 392 forks source link

Suppressing functions #623

Open ZeroIntensity opened 3 months ago

ZeroIntensity commented 3 months ago

Is there an existing proposal for this?

Is your feature request related to a problem?

Python comes with several built-in "memory leaks" (for example, re.compile, from your docs), making it difficult to write code that doesn't get marked by Memray as leaking memory in some way or another.

Describe the solution you'd like

Memray could support adding a suppressions file. This could be in an ini file (since that's in the standard library), or make its own format - similar to how Valgrind does it.

Alternatives you considered

I've considered modifying get_allocations to manually remove some functions from the report.