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>
This commit is contained in:
László Kiss Kollár 2025-09-14 23:47:14 +01:00 committed by GitHub
parent efc08c5fbf
commit 3e06cfcaee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 292 additions and 174 deletions

View file

@ -7,5 +7,6 @@
from .collector import Collector
from .pstats_collector import PstatsCollector
from .stack_collector import CollapsedStackCollector
from .string_table import StringTable
__all__ = ("Collector", "PstatsCollector", "CollapsedStackCollector")
__all__ = ("Collector", "PstatsCollector", "CollapsedStackCollector", "StringTable")