summaryrefslogtreecommitdiff
path: root/Doc/library/tracemalloc.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-26 00:40:10 +0100
committerVictor Stinner <victor.stinner@gmail.com>2013-11-26 00:40:10 +0100
commit00773df9f30f10fddef40fec13827cca8a1b21bc (patch)
tree974cd9497d0a7f20138ec57883a077d7ee251fe9 /Doc/library/tracemalloc.rst
parentde2f132a5e052b8621be4b5a482a27a0b999fc35 (diff)
downloadcpython-git-00773df9f30f10fddef40fec13827cca8a1b21bc.tar.gz
Issue #18874: apply Jim Jewett's patch on tracemalloc doc
Diffstat (limited to 'Doc/library/tracemalloc.rst')
-rw-r--r--Doc/library/tracemalloc.rst22
1 files changed, 13 insertions, 9 deletions
diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst
index 0e11540aa2..2e1902e959 100644
--- a/Doc/library/tracemalloc.rst
+++ b/Doc/library/tracemalloc.rst
@@ -102,9 +102,11 @@ Example of output before/after running some tests of the Python test suite::
/usr/lib/python3.4/urllib/parse.py:476: size=71.8 KiB (+71.8 KiB), count=969 (+969), average=76 B
/usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 (+126), average=546 B
-We can see that Python loaded ``4.4 MiB`` of new data (bytecode and constants)
-from modules (on of total of ``8.2 MiB``) and that the :mod:`linecache` module
-cached ``940 KiB`` of Python source code to format tracebacks.
+We can see that Python has loaded ``8.2 MiB`` of module data (bytecode and
+constants), and that this is ``4.4 MiB`` more than had been loaded before the
+tests, when the previous snapshot was taken. Similarly, the :mod:`linecache`
+module has cached ``940 KiB`` of Python source code to format tracebacks, all
+of it since the previous snapshot.
If the system has little free memory, snapshots can be written on disk using
the :meth:`Snapshot.dump` method to analyze the snapshot offline. Then use the
@@ -174,11 +176,11 @@ Example of output of the Python test suite (traceback limited to 25 frames)::
File "/usr/lib/python3.4/runpy.py", line 160
"__main__", fname, loader, pkg_name)
-We can see that most memory was allocated in the :mod:`importlib` module to
+We can see that the most memory was allocated in the :mod:`importlib` module to
load data (bytecode and constants) from modules: ``870 KiB``. The traceback is
-where the :mod:`importlib` loaded data for the the last time: on the ``import
-pdb`` line of the :mod:`doctest` module. The traceback may change if a new
-module is loaded.
+where the :mod:`importlib` loaded data most recently: on the ``import pdb``
+line of the :mod:`doctest` module. The traceback may change if a new module is
+loaded.
Pretty top
@@ -319,12 +321,14 @@ Functions
.. function:: stop()
Stop tracing Python memory allocations: uninstall hooks on Python memory
- allocators. Clear also traces of memory blocks allocated by Python
+ allocators. Also clears all previously collected traces of memory blocks
+ allocated by Python.
Call :func:`take_snapshot` function to take a snapshot of traces before
clearing them.
- See also :func:`start` and :func:`is_tracing` functions.
+ See also :func:`start`, :func:`is_tracing` and :func:`clear_traces`
+ functions.
.. function:: take_snapshot()