Hi, I designed tracemalloc with Charles-François Natali in PEP 454. The API is a lightweight abstraction on top of the internal C structures used by the C _tracemalloc module which is designed to minimize the memory footprint.
I'm not aware of the pstats format. Adding a new tracemalloc.dump_pstats() function looks like a good idea. Does pstats allow to attach arbitrary data to a traceback? The root structure of tracemalloc is basically the tuple (size: int, traceback) (trace_t structure in C). Victor Le jeu. 27 juin 2019 à 21:03, Yonatan Zunger <[email protected]> a écrit : > > > Hi everyone, > > Something occurred to me while trying to analyze code today: profiler and > cProfiler emit their data in pstats format, which various tools and libraries > consume. tracemalloc, on the other hand, uses a completely separate format > which nonetheless contains similar data. In fact, in many non-Python > applications I've worked in, heap and CPU profiles were always emitted in > identical formats, which allowed things like visual representations of stack > traces where memory is allocated, and these have proven quite useful in > practice and allowed lots of sharing of tools across many applications. > > Is there a particular design reason why these formats are different in Python > right now? Would it make sense to consider allowing them to match, e.g. > having a tracemalloc.dump_pstats() method? > > Yonatan > _______________________________________________ > Python-Dev mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/3JFFWGJ57LQRZI3CVJXF5P7NYRCEWCJB/ -- Night gathers, and now my watch begins. It shall not end until my death. _______________________________________________ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/64NPCX5C3MUG5CB5LR3UWH7GCXHZYYPB/
