💾 Archived View for tris.fyi › pydoc › tracemalloc captured on 2022-03-01 at 15:58:53. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-01-08)

➡️ Next capture (2022-04-28)

🚧 View Differences

-=-=-=-=-=-=-

Back to module index

Go to module by name

tracemalloc

This module has no docstring.

Classes

BaseFilter

DomainFilter

domain = <property object at 0x7f022703aae0>

Filter

filename_pattern = <property object at 0x7f022703aa40>

Frame


    Frame of a traceback.
    
filename = <property object at 0x7f022703a720>
lineno = <property object at 0x7f022703a6d0>

Iterable

Sequence

All the operations on a read-only sequence.

    Concrete subclasses must override __new__ or __init__,
    __getitem__, and __len__.
    
count(self, value)

  S.count(value) -> integer -- return number of occurrences of value
index(self, value, start=0, stop=None)

  S.index(value, [start, [stop]]) -> integer -- return first index of value.
             Raises ValueError if the value is not present.

             Supporting start and stop arguments is optional, but
             recommended.
        

Snapshot


    Snapshot of traces of memory blocks allocated by Python.
    
compare_to(self, old_snapshot, key_type, cumulative=False)


          Compute the differences with an old snapshot old_snapshot. Get
          statistics as a sorted list of StatisticDiff instances, grouped by
          group_by.
        
dump(self, filename)


          Write the snapshot into a file.
        
filter_traces(self, filters)


          Create a new Snapshot instance with a filtered traces sequence, filters
          is a list of Filter or DomainFilter instances.  If filters is an empty
          list, return a new Snapshot instance with a copy of the traces.
        
load(filename)


          Load a snapshot from a file.
        
statistics(self, key_type, cumulative=False)


          Group statistics by key_type. Return a sorted list of Statistic
          instances.
        

Statistic


    Statistic difference on memory allocations between two Snapshot instance.
    
count = <member 'count' of 'Statistic' objects>
size = <member 'size' of 'Statistic' objects>
traceback = <member 'traceback' of 'Statistic' objects>

StatisticDiff


    Statistic difference on memory allocations between an old and a new
    Snapshot instance.
    
count = <member 'count' of 'StatisticDiff' objects>
count_diff = <member 'count_diff' of 'StatisticDiff' objects>
size = <member 'size' of 'StatisticDiff' objects>
size_diff = <member 'size_diff' of 'StatisticDiff' objects>
traceback = <member 'traceback' of 'StatisticDiff' objects>

Trace


    Trace of a memory block.
    
domain = <property object at 0x7f022703a860>
size = <property object at 0x7f022703a8b0>
traceback = <property object at 0x7f022703a900>

Traceback


    Sequence of Frame instances sorted from the oldest frame
    to the most recent frame.
    
count(self, value)

  S.count(value) -> integer -- return number of occurrences of value
format(self, limit=None, most_recent_first=False)
index(self, value, start=0, stop=None)

  S.index(value, [start, [stop]]) -> integer -- return first index of value.
             Raises ValueError if the value is not present.

             Supporting start and stop arguments is optional, but
             recommended.
        
total_nframe = <property object at 0x7f022703a7c0>

Functions

clear_traces

clear_traces()

  Clear traces of memory blocks allocated by Python.

get_object_traceback

get_object_traceback(obj)


      Get the traceback where the Python object *obj* was allocated.
      Return a Traceback instance.

      Return None if the tracemalloc module is not tracing memory allocations or
      did not trace the allocation of the object.
    

get_traceback_limit

get_traceback_limit()

  Get the maximum number of frames stored in the traceback of a trace.

  By default, a trace of an allocated memory block only stores
  the most recent frame: the limit is 1.

get_traced_memory

get_traced_memory()

  Get the current size and peak size of memory blocks traced by tracemalloc.

  Returns a tuple: (current: int, peak: int).

get_tracemalloc_memory

get_tracemalloc_memory()

  Get the memory usage in bytes of the tracemalloc module.

  This memory is used internally to trace memory allocations.

is_tracing

is_tracing()

  Return True if the tracemalloc module is tracing Python memory allocations.

reset_peak

reset_peak()

  Set the peak size of memory blocks traced by tracemalloc to the current size.

  Do nothing if the tracemalloc module is not tracing memory allocations.

start

start(nframe=1, /)

  Start tracing Python memory allocations.

  Also set the maximum number of frames stored in the traceback of a
  trace to nframe.

stop

stop()

  Stop tracing Python memory allocations.

  Also clear traces of memory blocks allocated by Python.

take_snapshot

take_snapshot()


      Take a snapshot of traces of memory blocks allocated by Python.
    

total_ordering

total_ordering(cls)

  Class decorator that fills in missing ordering methods

Modules

fnmatch

linecache

os

pickle