# Copyright (C) 2001-2018, Python Software Foundation # For licence information, see README file. # msgid "" msgstr "" "Project-Id-Version: Python 3\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-23 16:16+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: FRENCH \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tracemalloc.rst:2 msgid ":mod:`tracemalloc` --- Trace memory allocations" msgstr "" #: library/tracemalloc.rst:9 #, fuzzy msgid "**Source code:** :source:`Lib/tracemalloc.py`" msgstr "**Code source :** :source:`Lib/abc.py`" #: library/tracemalloc.rst:13 msgid "" "The tracemalloc module is a debug tool to trace memory blocks allocated by " "Python. It provides the following information:" msgstr "" #: library/tracemalloc.rst:16 msgid "Traceback where an object was allocated" msgstr "" #: library/tracemalloc.rst:17 msgid "" "Statistics on allocated memory blocks per filename and per line number: " "total size, number and average size of allocated memory blocks" msgstr "" #: library/tracemalloc.rst:19 msgid "Compute the differences between two snapshots to detect memory leaks" msgstr "" #: library/tracemalloc.rst:21 msgid "" "To trace most memory blocks allocated by Python, the module should be " "started as early as possible by setting the :envvar:`PYTHONTRACEMALLOC` " "environment variable to ``1``, or by using :option:`-X` ``tracemalloc`` " "command line option. The :func:`tracemalloc.start` function can be called at " "runtime to start tracing Python memory allocations." msgstr "" #: library/tracemalloc.rst:27 msgid "" "By default, a trace of an allocated memory block only stores the most recent " "frame (1 frame). To store 25 frames at startup: set the :envvar:" "`PYTHONTRACEMALLOC` environment variable to ``25``, or use the :option:`-X` " "``tracemalloc=25`` command line option." msgstr "" #: library/tracemalloc.rst:34 msgid "Examples" msgstr "Exemples" #: library/tracemalloc.rst:37 msgid "Display the top 10" msgstr "" #: library/tracemalloc.rst:39 msgid "Display the 10 files allocating the most memory::" msgstr "" #: library/tracemalloc.rst:225 msgid "Example of output of the Python test suite::" msgstr "" #: library/tracemalloc.rst:69 msgid "" "We can see that Python loaded ``4855 KiB`` data (bytecode and constants) " "from modules and that the :mod:`collections` module allocated ``244 KiB`` to " "build :class:`~collections.namedtuple` types." msgstr "" #: library/tracemalloc.rst:250 msgid "See :meth:`Snapshot.statistics` for more options." msgstr "" #: library/tracemalloc.rst:77 msgid "Compute differences" msgstr "" #: library/tracemalloc.rst:79 msgid "Take two snapshots and display the differences::" msgstr "" #: library/tracemalloc.rst:95 msgid "" "Example of output before/after running some tests of the Python test suite::" msgstr "" #: library/tracemalloc.rst:109 msgid "" "We can see that Python has loaded ``8173 KiB`` of module data (bytecode and " "constants), and that this is ``4428 KiB`` 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." msgstr "" #: library/tracemalloc.rst:115 msgid "" "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 :meth:`Snapshot.load` method reload the snapshot." msgstr "" #: library/tracemalloc.rst:121 msgid "Get the traceback of a memory block" msgstr "" #: library/tracemalloc.rst:123 msgid "Code to display the traceback of the biggest memory block::" msgstr "" #: library/tracemalloc.rst:141 msgid "" "Example of output of the Python test suite (traceback limited to 25 frames)::" msgstr "" #: library/tracemalloc.rst:178 msgid "" "We can see that the most memory was allocated in the :mod:`importlib` module " "to load data (bytecode and constants) from modules: ``870.1 KiB``. The " "traceback is 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." msgstr "" #: library/tracemalloc.rst:186 msgid "Pretty top" msgstr "" #: library/tracemalloc.rst:188 msgid "" "Code to display the 10 lines allocating the most memory with a pretty " "output, ignoring ```` and ```` files::" msgstr "" #: library/tracemalloc.rst:253 msgid "Record the current and peak size of all traced memory blocks" msgstr "" #: library/tracemalloc.rst:255 msgid "" "The following code computes two sums like ``0 + 1 + 2 + ...`` inefficiently, " "by creating a list of those numbers. This list consumes a lot of memory " "temporarily. We can use :func:`get_traced_memory` and :func:`reset_peak` to " "observe the small memory usage after the sum is computed as well as the peak " "memory usage during the computations::" msgstr "" #: library/tracemalloc.rst:759 msgid "Output::" msgstr "Sortie ::" #: library/tracemalloc.rst:285 msgid "" "Using :func:`reset_peak` ensured we could accurately record the peak during " "the computation of ``small_sum``, even though it is much smaller than the " "overall peak size of memory blocks since the :func:`start` call. Without the " "call to :func:`reset_peak`, ``second_peak`` would still be the peak from the " "computation ``large_sum`` (that is, equal to ``first_peak``). In this case, " "both peaks are much higher than the final memory usage, and which suggests " "we could optimise (by removing the unnecessary call to :class:`list`, and " "writing ``sum(range(...))``)." msgstr "" #: library/tracemalloc.rst:295 msgid "API" msgstr "API" #: library/tracemalloc.rst:298 msgid "Functions" msgstr "Fonctions" #: library/tracemalloc.rst:302 msgid "Clear traces of memory blocks allocated by Python." msgstr "" #: library/tracemalloc.rst:304 msgid "See also :func:`stop`." msgstr "" #: library/tracemalloc.rst:309 msgid "" "Get the traceback where the Python object *obj* was allocated. Return a :" "class:`Traceback` instance, or ``None`` if the :mod:`tracemalloc` module is " "not tracing memory allocations or did not trace the allocation of the object." msgstr "" #: library/tracemalloc.rst:314 msgid "See also :func:`gc.get_referrers` and :func:`sys.getsizeof` functions." msgstr "" #: library/tracemalloc.rst:319 msgid "Get the maximum number of frames stored in the traceback of a trace." msgstr "" #: library/tracemalloc.rst:321 msgid "" "The :mod:`tracemalloc` module must be tracing memory allocations to get the " "limit, otherwise an exception is raised." msgstr "" #: library/tracemalloc.rst:324 msgid "The limit is set by the :func:`start` function." msgstr "" #: library/tracemalloc.rst:329 msgid "" "Get the current size and peak size of memory blocks traced by the :mod:" "`tracemalloc` module as a tuple: ``(current: int, peak: int)``." msgstr "" #: library/tracemalloc.rst:335 msgid "" "Set the peak size of memory blocks traced by the :mod:`tracemalloc` module " "to the current size." msgstr "" #: library/tracemalloc.rst:338 msgid "" "Do nothing if the :mod:`tracemalloc` module is not tracing memory " "allocations." msgstr "" #: library/tracemalloc.rst:341 msgid "" "This function only modifies the recorded peak size, and does not modify or " "clear any traces, unlike :func:`clear_traces`. Snapshots taken with :func:" "`take_snapshot` before a call to :func:`reset_peak` can be meaningfully " "compared to snapshots taken after the call." msgstr "" #: library/tracemalloc.rst:346 msgid "See also :func:`get_traced_memory`." msgstr "" #: library/tracemalloc.rst:353 msgid "" "Get the memory usage in bytes of the :mod:`tracemalloc` module used to store " "traces of memory blocks. Return an :class:`int`." msgstr "" #: library/tracemalloc.rst:360 msgid "" "``True`` if the :mod:`tracemalloc` module is tracing Python memory " "allocations, ``False`` otherwise." msgstr "" #: library/tracemalloc.rst:363 msgid "See also :func:`start` and :func:`stop` functions." msgstr "" #: library/tracemalloc.rst:368 msgid "" "Start tracing Python memory allocations: install hooks on Python memory " "allocators. Collected tracebacks of traces will be limited to *nframe* " "frames. By default, a trace of a memory block only stores the most recent " "frame: the limit is ``1``. *nframe* must be greater or equal to ``1``." msgstr "" #: library/tracemalloc.rst:373 msgid "" "You can still read the original number of total frames that composed the " "traceback by looking at the :attr:`Traceback.total_nframe` attribute." msgstr "" #: library/tracemalloc.rst:376 msgid "" "Storing more than ``1`` frame is only useful to compute statistics grouped " "by ``'traceback'`` or to compute cumulative statistics: see the :meth:" "`Snapshot.compare_to` and :meth:`Snapshot.statistics` methods." msgstr "" #: library/tracemalloc.rst:380 msgid "" "Storing more frames increases the memory and CPU overhead of the :mod:" "`tracemalloc` module. Use the :func:`get_tracemalloc_memory` function to " "measure how much memory is used by the :mod:`tracemalloc` module." msgstr "" #: library/tracemalloc.rst:384 msgid "" "The :envvar:`PYTHONTRACEMALLOC` environment variable " "(``PYTHONTRACEMALLOC=NFRAME``) and the :option:`-X` ``tracemalloc=NFRAME`` " "command line option can be used to start tracing at startup." msgstr "" #: library/tracemalloc.rst:388 msgid "" "See also :func:`stop`, :func:`is_tracing` and :func:`get_traceback_limit` " "functions." msgstr "" #: library/tracemalloc.rst:394 msgid "" "Stop tracing Python memory allocations: uninstall hooks on Python memory " "allocators. Also clears all previously collected traces of memory blocks " "allocated by Python." msgstr "" #: library/tracemalloc.rst:398 msgid "" "Call :func:`take_snapshot` function to take a snapshot of traces before " "clearing them." msgstr "" #: library/tracemalloc.rst:401 msgid "" "See also :func:`start`, :func:`is_tracing` and :func:`clear_traces` " "functions." msgstr "" #: library/tracemalloc.rst:407 msgid "" "Take a snapshot of traces of memory blocks allocated by Python. Return a " "new :class:`Snapshot` instance." msgstr "" #: library/tracemalloc.rst:410 msgid "" "The snapshot does not include memory blocks allocated before the :mod:" "`tracemalloc` module started to trace memory allocations." msgstr "" #: library/tracemalloc.rst:413 msgid "" "Tracebacks of traces are limited to :func:`get_traceback_limit` frames. Use " "the *nframe* parameter of the :func:`start` function to store more frames." msgstr "" #: library/tracemalloc.rst:416 msgid "" "The :mod:`tracemalloc` module must be tracing memory allocations to take a " "snapshot, see the :func:`start` function." msgstr "" #: library/tracemalloc.rst:419 msgid "See also the :func:`get_object_traceback` function." msgstr "" #: library/tracemalloc.rst:423 msgid "DomainFilter" msgstr "" #: library/tracemalloc.rst:427 msgid "Filter traces of memory blocks by their address space (domain)." msgstr "" #: library/tracemalloc.rst:433 msgid "" "If *inclusive* is ``True`` (include), match memory blocks allocated in the " "address space :attr:`domain`." msgstr "" #: library/tracemalloc.rst:436 msgid "" "If *inclusive* is ``False`` (exclude), match memory blocks not allocated in " "the address space :attr:`domain`." msgstr "" #: library/tracemalloc.rst:693 msgid "Address space of a memory block (``int``). Read-only property." msgstr "" #: library/tracemalloc.rst:445 msgid "Filter" msgstr "" #: library/tracemalloc.rst:449 msgid "Filter on traces of memory blocks." msgstr "" #: library/tracemalloc.rst:451 msgid "" "See the :func:`fnmatch.fnmatch` function for the syntax of " "*filename_pattern*. The ``'.pyc'`` file extension is replaced with ``'.py'``." msgstr "" #: library/tracemalloc.rst:455 msgid "Examples:" msgstr "Exemples :" #: library/tracemalloc.rst:457 msgid "" "``Filter(True, subprocess.__file__)`` only includes traces of the :mod:" "`subprocess` module" msgstr "" #: library/tracemalloc.rst:459 msgid "" "``Filter(False, tracemalloc.__file__)`` excludes traces of the :mod:" "`tracemalloc` module" msgstr "" #: library/tracemalloc.rst:461 msgid "``Filter(False, \"\")`` excludes empty tracebacks" msgstr "" #: library/tracemalloc.rst:464 msgid "The ``'.pyo'`` file extension is no longer replaced with ``'.py'``." msgstr "" #: library/tracemalloc.rst:688 msgid "Added the :attr:`domain` attribute." msgstr "" #: library/tracemalloc.rst:473 msgid "Address space of a memory block (``int`` or ``None``)." msgstr "" #: library/tracemalloc.rst:695 msgid "" "tracemalloc uses the domain ``0`` to trace memory allocations made by " "Python. C extensions can use other domains to trace other resources." msgstr "" #: library/tracemalloc.rst:480 msgid "" "If *inclusive* is ``True`` (include), only match memory blocks allocated in " "a file with a name matching :attr:`filename_pattern` at line number :attr:" "`lineno`." msgstr "" #: library/tracemalloc.rst:484 msgid "" "If *inclusive* is ``False`` (exclude), ignore memory blocks allocated in a " "file with a name matching :attr:`filename_pattern` at line number :attr:" "`lineno`." msgstr "" #: library/tracemalloc.rst:490 msgid "" "Line number (``int``) of the filter. If *lineno* is ``None``, the filter " "matches any line number." msgstr "" #: library/tracemalloc.rst:495 msgid "Filename pattern of the filter (``str``). Read-only property." msgstr "" #: library/tracemalloc.rst:499 msgid "" "If *all_frames* is ``True``, all frames of the traceback are checked. If " "*all_frames* is ``False``, only the most recent frame is checked." msgstr "" #: library/tracemalloc.rst:502 msgid "" "This attribute has no effect if the traceback limit is ``1``. See the :func:" "`get_traceback_limit` function and :attr:`Snapshot.traceback_limit` " "attribute." msgstr "" #: library/tracemalloc.rst:508 msgid "Frame" msgstr "" #: library/tracemalloc.rst:512 msgid "Frame of a traceback." msgstr "" #: library/tracemalloc.rst:514 msgid "The :class:`Traceback` class is a sequence of :class:`Frame` instances." msgstr "" #: library/tracemalloc.rst:518 msgid "Filename (``str``)." msgstr "" #: library/tracemalloc.rst:522 msgid "Line number (``int``)." msgstr "" #: library/tracemalloc.rst:526 msgid "Snapshot" msgstr "" #: library/tracemalloc.rst:530 msgid "Snapshot of traces of memory blocks allocated by Python." msgstr "" #: library/tracemalloc.rst:532 msgid "The :func:`take_snapshot` function creates a snapshot instance." msgstr "" #: library/tracemalloc.rst:536 msgid "" "Compute the differences with an old snapshot. Get statistics as a sorted " "list of :class:`StatisticDiff` instances grouped by *key_type*." msgstr "" #: library/tracemalloc.rst:539 msgid "" "See the :meth:`Snapshot.statistics` method for *key_type* and *cumulative* " "parameters." msgstr "" #: library/tracemalloc.rst:542 msgid "" "The result is sorted from the biggest to the smallest by: absolute value of :" "attr:`StatisticDiff.size_diff`, :attr:`StatisticDiff.size`, absolute value " "of :attr:`StatisticDiff.count_diff`, :attr:`Statistic.count` and then by :" "attr:`StatisticDiff.traceback`." msgstr "" #: library/tracemalloc.rst:550 msgid "Write the snapshot into a file." msgstr "" #: library/tracemalloc.rst:552 msgid "Use :meth:`load` to reload the snapshot." msgstr "" #: library/tracemalloc.rst:557 msgid "" "Create a new :class:`Snapshot` instance with a filtered :attr:`traces` " "sequence, *filters* is a list of :class:`DomainFilter` and :class:`Filter` " "instances. If *filters* is an empty list, return a new :class:`Snapshot` " "instance with a copy of the traces." msgstr "" #: library/tracemalloc.rst:562 msgid "" "All inclusive filters are applied at once, a trace is ignored if no " "inclusive filters match it. A trace is ignored if at least one exclusive " "filter matches it." msgstr "" #: library/tracemalloc.rst:566 msgid ":class:`DomainFilter` instances are now also accepted in *filters*." msgstr "" #: library/tracemalloc.rst:572 msgid "Load a snapshot from a file." msgstr "" #: library/tracemalloc.rst:574 msgid "See also :meth:`dump`." msgstr "" #: library/tracemalloc.rst:579 msgid "" "Get statistics as a sorted list of :class:`Statistic` instances grouped by " "*key_type*:" msgstr "" #: library/tracemalloc.rst:583 msgid "key_type" msgstr "" #: library/tracemalloc.rst:583 msgid "description" msgstr "description" #: library/tracemalloc.rst:585 msgid "``'filename'``" msgstr "``'filename'``" #: library/tracemalloc.rst:585 msgid "filename" msgstr "filename" #: library/tracemalloc.rst:586 msgid "``'lineno'``" msgstr "``'lineno'``" #: library/tracemalloc.rst:586 msgid "filename and line number" msgstr "" #: library/tracemalloc.rst:587 msgid "``'traceback'``" msgstr "``'traceback'``" #: library/tracemalloc.rst:587 msgid "traceback" msgstr "traceback" #: library/tracemalloc.rst:590 msgid "" "If *cumulative* is ``True``, cumulate size and count of memory blocks of all " "frames of the traceback of a trace, not only the most recent frame. The " "cumulative mode can only be used with *key_type* equals to ``'filename'`` " "and ``'lineno'``." msgstr "" #: library/tracemalloc.rst:595 msgid "" "The result is sorted from the biggest to the smallest by: :attr:`Statistic." "size`, :attr:`Statistic.count` and then by :attr:`Statistic.traceback`." msgstr "" #: library/tracemalloc.rst:602 msgid "" "Maximum number of frames stored in the traceback of :attr:`traces`: result " "of the :func:`get_traceback_limit` when the snapshot was taken." msgstr "" #: library/tracemalloc.rst:607 msgid "" "Traces of all memory blocks allocated by Python: sequence of :class:`Trace` " "instances." msgstr "" #: library/tracemalloc.rst:610 msgid "" "The sequence has an undefined order. Use the :meth:`Snapshot.statistics` " "method to get a sorted list of statistics." msgstr "" #: library/tracemalloc.rst:615 msgid "Statistic" msgstr "" #: library/tracemalloc.rst:619 msgid "Statistic on memory allocations." msgstr "" #: library/tracemalloc.rst:621 msgid "" ":func:`Snapshot.statistics` returns a list of :class:`Statistic` instances." msgstr "" #: library/tracemalloc.rst:623 msgid "See also the :class:`StatisticDiff` class." msgstr "" #: library/tracemalloc.rst:627 msgid "Number of memory blocks (``int``)." msgstr "" #: library/tracemalloc.rst:631 msgid "Total size of memory blocks in bytes (``int``)." msgstr "" #: library/tracemalloc.rst:704 msgid "" "Traceback where the memory block was allocated, :class:`Traceback` instance." msgstr "" #: library/tracemalloc.rst:640 msgid "StatisticDiff" msgstr "" #: library/tracemalloc.rst:644 msgid "" "Statistic difference on memory allocations between an old and a new :class:" "`Snapshot` instance." msgstr "" #: library/tracemalloc.rst:647 msgid "" ":func:`Snapshot.compare_to` returns a list of :class:`StatisticDiff` " "instances. See also the :class:`Statistic` class." msgstr "" #: library/tracemalloc.rst:652 msgid "" "Number of memory blocks in the new snapshot (``int``): ``0`` if the memory " "blocks have been released in the new snapshot." msgstr "" #: library/tracemalloc.rst:657 msgid "" "Difference of number of memory blocks between the old and the new snapshots " "(``int``): ``0`` if the memory blocks have been allocated in the new " "snapshot." msgstr "" #: library/tracemalloc.rst:663 msgid "" "Total size of memory blocks in bytes in the new snapshot (``int``): ``0`` if " "the memory blocks have been released in the new snapshot." msgstr "" #: library/tracemalloc.rst:668 msgid "" "Difference of total size of memory blocks in bytes between the old and the " "new snapshots (``int``): ``0`` if the memory blocks have been allocated in " "the new snapshot." msgstr "" #: library/tracemalloc.rst:674 msgid "" "Traceback where the memory blocks were allocated, :class:`Traceback` " "instance." msgstr "" #: library/tracemalloc.rst:679 msgid "Trace" msgstr "" #: library/tracemalloc.rst:683 msgid "Trace of a memory block." msgstr "" #: library/tracemalloc.rst:685 msgid "" "The :attr:`Snapshot.traces` attribute is a sequence of :class:`Trace` " "instances." msgstr "" #: library/tracemalloc.rst:700 msgid "Size of the memory block in bytes (``int``)." msgstr "" #: library/tracemalloc.rst:709 msgid "Traceback" msgstr "" #: library/tracemalloc.rst:713 msgid "" "Sequence of :class:`Frame` instances sorted from the oldest frame to the " "most recent frame." msgstr "" #: library/tracemalloc.rst:716 msgid "" "A traceback contains at least ``1`` frame. If the ``tracemalloc`` module " "failed to get a frame, the filename ``\"\"`` at line number ``0`` " "is used." msgstr "" #: library/tracemalloc.rst:720 msgid "" "When a snapshot is taken, tracebacks of traces are limited to :func:" "`get_traceback_limit` frames. See the :func:`take_snapshot` function. The " "original number of frames of the traceback is stored in the :attr:`Traceback." "total_nframe` attribute. That allows to know if a traceback has been " "truncated by the traceback limit." msgstr "" #: library/tracemalloc.rst:726 msgid "" "The :attr:`Trace.traceback` attribute is an instance of :class:`Traceback` " "instance." msgstr "" #: library/tracemalloc.rst:729 msgid "" "Frames are now sorted from the oldest to the most recent, instead of most " "recent to oldest." msgstr "" #: library/tracemalloc.rst:734 msgid "" "Total number of frames that composed the traceback before truncation. This " "attribute can be set to ``None`` if the information is not available." msgstr "" #: library/tracemalloc.rst:738 msgid "The :attr:`Traceback.total_nframe` attribute was added." msgstr "" #: library/tracemalloc.rst:743 msgid "" "Format the traceback as a list of lines. Use the :mod:`linecache` module to " "retrieve lines from the source code. If *limit* is set, format the *limit* " "most recent frames if *limit* is positive. Otherwise, format the " "``abs(limit)`` oldest frames. If *most_recent_first* is ``True``, the order " "of the formatted frames is reversed, returning the most recent frame first " "instead of last." msgstr "" #: library/tracemalloc.rst:750 msgid "" "Similar to the :func:`traceback.format_tb` function, except that :meth:`." "format` does not include newlines." msgstr "" #: library/tracemalloc.rst:753 msgid "Example::" msgstr "Exemple ::"