summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tracemalloc.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.9] bpo-45229: Remove test_main in many tests (GH-28405) (GH-28456)Serhiy Storchaka2021-09-201-11/+1
| | | | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests.. (cherry picked from commit 40348acc180580371d25f75f46b27048e35f2435)
* bpo-37961: Fix regression in tracemalloc.Traceback.__repr__ (GH-23805)Miss Islington (bot)2020-12-161-0/+20
| | | | | | Regression in 8d59eb1b66c51b2b918da9881c57d07d08df43b7. (cherry picked from commit 051b9818671625d125dee8198e0d2af5ad4c85b8) Co-authored-by: Daniel Hahler <git@thequod.de>
* [3.9] bpo-40630: Add tracemalloc.reset_peak (GH-20102) (GH-20545)Huon Wilson2020-06-011-0/+24
| | | | | | | | | | | * bpo-40630: Add tracemalloc.reset_peak (GH-20102, cherrypick 8b62644) The reset_peak function sets the peak memory size to the current size, representing a resetting of that metric. This allows for recording the peak of specific sections of code, ignoring other code that may have had a higher peak (since the most recent `tracemalloc.start()` or tracemalloc.clear_traces()` call). * Adjust docs to point to 3.9
* bpo-40094: Add test.support.wait_process() (GH-19254)Victor Stinner2020-03-311-4/+1
| | | | | | | | | Moreover, the following tests now check the child process exit code: * test_os.PtyTests * test_mailbox.test_lock_conflict() * test_tempfile.test_process_awareness() * test_uuid.testIssue8621() * multiprocessing resource tracker tests
* bpo-37961, tracemalloc: add Traceback.total_nframe (GH-15545)Julien Danjou2019-10-151-43/+47
| | | | Add a total_nframe field to the traces collected by the tracemalloc module. This field indicates the original number of frames before it was truncated.
* Fix typos mostly in comments, docs and test names (GH-15209)Min ho Kim2019-08-301-2/+2
|
* bpo-35053: Enhance tracemalloc to trace free lists (GH-10063)Victor Stinner2018-10-251-0/+20
| | | | | | | | | | | | tracemalloc now tries to update the traceback when an object is reused from a "free list" (optimization for faster object creation, used by the builtin list type for example). Changes: * Add _PyTraceMalloc_NewReference() function which tries to update the Python traceback of a Python object. * _Py_NewReference() now calls _PyTraceMalloc_NewReference(). * Add an unit test.
* bpo-12458: Fix line numbers for multiline expressions. (GH-8774)Serhiy Storchaka2018-09-171-1/+1
|
* bpo-34228: Allow PYTHONTRACEMALLOC=0 (GH-8467)Victor Stinner2018-07-251-2/+10
| | | | | PYTHONTRACEMALLOC=0 environment variable and -X tracemalloc=0 command line option are now allowed to disable explicitly tracemalloc at startup.
* bpo-32121: Add most_recent_first parameter to tracemalloc.Traceback.format ↵Jesse-Bakker2017-11-291-6/+24
| | | | | | | | (#4534) * Add most_recent_first parameter to tracemalloc.Traceback.format to allow reversing the order of the frames in the output * Reversed default sorting of tracemalloc.Traceback frames * Allowed negative limit, truncating from the other side.
* bpo-32030: Enhance Py_Main() (#4412)Victor Stinner2017-11-161-13/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parse more env vars in Py_Main(): * Add more options to _PyCoreConfig: * faulthandler * tracemalloc * importtime * Move code to parse environment variables from _Py_InitializeCore() to Py_Main(). This change fixes a regression from Python 3.6: PYTHONUNBUFFERED is now read before calling pymain_init_stdio(). * _PyFaulthandler_Init() and _PyTraceMalloc_Init() now take an argument to decide if the module has to be enabled at startup. * tracemalloc_start() is now responsible to check the maximum number of frames. Other changes: * Cleanup Py_Main(): * Rename some pymain_xxx() subfunctions * Add pymain_run_python() subfunction * Cleanup Py_NewInterpreter() * _PyInterpreterState_Enable() now reports failure * init_hash_secret() now considers pyurandom() failure as an "user error": don't fail with abort(). * pymain_optlist_append() and pymain_strdup() now sets err on memory allocation failure.
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-4/+1
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-29845: Mark tests that use _testcapi as CPython-only (#711)Serhiy Storchaka2017-03-191-0/+1
|
* Merge doc and comment fixes from 3.5Martin Panter2016-04-191-1/+1
|\
| * Fix spelling (inital), grammar (may translates) in documentation, commentsMartin Panter2016-04-191-1/+1
| |
* | Issue #26588: remove debug traces from _tracemalloc.Victor Stinner2016-03-221-10/+0
| |
* | Issue #26588: add debug tracesVictor Stinner2016-03-221-0/+10
| | | | | | | | Try to debug random failure on buildbots.
* | Add C functions _PyTraceMalloc_Track()Victor Stinner2016-03-221-0/+115
| | | | | | | | | | | | | | | | Issue #26530: * Add C functions _PyTraceMalloc_Track() and _PyTraceMalloc_Untrack() to track memory blocks using the tracemalloc module. * Add _PyTraceMalloc_GetTraceback() to get the traceback of an object.
* | tracemalloc now supports domainsVictor Stinner2016-03-221-27/+77
|/ | | | | | | | | | | | | | | | | Issue #26588: * The _tracemalloc now supports tracing memory allocations of multiple address spaces (domains). * Add domain parameter to tracemalloc_add_trace() and tracemalloc_remove_trace(). * tracemalloc_add_trace() now starts by removing the previous trace, if any. * _tracemalloc._get_traces() now returns a list of (domain, size, traceback_frames): the domain is new. * Add tracemalloc.DomainFilter * tracemalloc.Filter: add an optional domain parameter to the constructor and a domain attribute * Sublte change: use Py_uintptr_t rather than void* in the traces key. * Add tracemalloc_config.use_domain, currently hardcoded to 1
* Issue #23731: Fix tracemalloc test on Windows.Zachary Ware2015-05-131-2/+3
| | | | 'a.pyo' can no longer match 'a.py', so 'a.PYO' can't either.
* Issue #9517: Move script_helper to the support package.Berker Peksag2015-05-061-3/+4
| | | | Patch by Christie Wilson.
* Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-5/+1
| | | | | | The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.
* Skip some tests that require a subinterpreter launched with -E or -I when theGregory P. Smith2015-02-041-1/+3
|\ | | | | | | | | | | | | | | interpreter under test is being run in an environment that requires the use of environment variables such as PYTHONHOME in order to function at all. Adds a test.script_helper.interpreter_requires_environment() function to be used with @unittest.skipIf on stdlib test methods requiring this.
| * Skip some tests that require a subinterpreter launched with -E or -I when theGregory P. Smith2015-02-041-1/+3
|/ | | | | | | | interpreter under test is being run in an environment that requires the use of environment variables such as PYTHONHOME in order to function at all. Adds a private test.script_helper._interpreter_requires_environment() function to be used with @unittest.skipIf on stdlib test methods requiring this.
* Break up TestCommandLine.test_env_var into four distinct tests.Gregory P. Smith2015-01-221-3/+5
|
* Issue #21639: Add a test to check that PyMem_Malloc(0) with tracemalloc enabledVictor Stinner2014-06-021-0/+6
| | | | does not crash.
* tracemalloc: filter_traces() raises a TypeError if filters is not an iterableVictor Stinner2014-03-101-0/+2
|
* Issue #20616: Add a format() method to tracemalloc.Traceback.Victor Stinner2014-02-161-0/+20
|
* tracemalloc: Fix slicing traces and fix slicing a traceback.Victor Stinner2014-02-011-2/+8
|
* Closes #19786: tracemalloc, remove the arbitrary limit of 100 framesVictor Stinner2013-11-271-6/+6
| | | | | | | | The limit is now 178,956,969 on 64 bit (it is greater on 32 bit because structures are smaller). Use int instead of Py_ssize_t to store the number of frames to have smaller traceback_t objects.
* Close #19798: replace "maximum" term with "peak" in get_traced_memory()Victor Stinner2013-11-271-7/+7
| | | | documentation. Use also the term "current" for the current size.
* Cleanup test_tracemalloc.py. Patch written by Vajrasky Kok.Victor Stinner2013-11-251-4/+2
|
* Issue #18874: Remove tracemalloc.set_traceback_limit()Victor Stinner2013-11-231-12/+9
| | | | tracemalloc.start() now has an option nframe parameter
* Issue #18874: Implement the PEP 454 (tracemalloc)Victor Stinner2013-11-231-0/+797