-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-40630: add tracemalloc.reset_peak #20102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
eb6c9ac
d1b1e33
6896e8c
b5dc058
2da86b3
218993e
9060f62
1269352
9deeb01
e44ca73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,6 +289,26 @@ Functions | |
:mod:`tracemalloc` module as a tuple: ``(current: int, peak: int)``. | ||
|
||
|
||
.. function:: reset_peak() | ||
|
||
Set the peak size of memory blocks traced by the :mod:`tracemalloc` module | ||
to the current size. | ||
|
||
The peak memory usage of a specific section of code can be determined as | ||
follows:: | ||
|
||
tracemalloc.reset_peak() | ||
|
||
# some code | ||
|
||
current, peak = tracemalloc.get_traced_memory() | ||
|
||
``peak`` will then be the peak size of traced memory blocks after the | ||
:func:`reset_peak` call, even if there was a higher peak before that. | ||
|
||
See also :func:`get_traced_memory`. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, you need to add ".. versionadded:: 3.10". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
.. function:: get_tracemalloc_memory() | ||
|
||
Get the memory usage in bytes of the :mod:`tracemalloc` module used to store | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Added :func:`tracemalloc.reset_peak` to set the peak size of traced memory | ||
blocks to the current size, to measure the peak of specific pieces of code. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.