]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-135953: Reduce memory usage of stack collectors (#138875)
authorLászló Kiss Kollár <kiss.kollar.laszlo@gmail.com>
Sun, 14 Sep 2025 22:47:14 +0000 (23:47 +0100)
committerGitHub <noreply@github.com>
Sun, 14 Sep 2025 22:47:14 +0000 (23:47 +0100)
commit3e06cfcaeee31c2a6e9befe5ea54d9beaa2c0434
tree67df8541094461a7b2e2692315dee41286aa2d7e
parentefc08c5fbfab109094a794d12ab8f6585dfb587d
gh-135953: Reduce memory usage of stack collectors (#138875)

The stack collector base class keeps all frames until export() is
called, which causes significant unnecessary memory usage. Instead, we
can process the frames on the fly in the collect call by dispatching the
aggregation logic to the subclass through the process_frames method.

Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
Lib/profiling/sampling/__init__.py
Lib/profiling/sampling/flamegraph.js
Lib/profiling/sampling/stack_collector.py
Lib/profiling/sampling/string_table.py [new file with mode: 0644]
Lib/test/test_profiling/test_sampling_profiler.py