Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4fea66d

Browse files
markshannonJelleZijlstra
authored andcommitted
pythonGH-101520: Move tracemalloc functionality into core, leaving interface in Modules. (python#104508)
1 parent1f381f2 commit4fea66d

File tree

11 files changed

+1625
-1549
lines changed

11 files changed

+1625
-1549
lines changed

‎Include/internal/pycore_pylifecycle.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc);
3131

3232
externvoid_Py_InitVersion(void);
3333
externPyStatus_PyFaulthandler_Init(intenable);
34-
externint_PyTraceMalloc_Init(intenable);
3534
externPyObject*_PyBuiltin_Init(PyInterpreterState*interp);
3635
externPyStatus_PySys_Create(
3736
PyThreadState*tstate,

‎Include/tracemalloc.h‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,40 @@ PyAPI_FUNC(int) PyTraceMalloc_Untrack(
3333
PyAPI_FUNC(PyObject*)_PyTraceMalloc_GetTraceback(
3434
unsignedintdomain,
3535
uintptr_tptr);
36+
37+
/* Return non-zero if tracemalloc is tracing */
38+
PyAPI_FUNC(int)_PyTraceMalloc_IsTracing(void);
39+
40+
/* Clear the tracemalloc traces */
41+
PyAPI_FUNC(void)_PyTraceMalloc_ClearTraces(void);
42+
43+
/* Clear the tracemalloc traces */
44+
PyAPI_FUNC(PyObject*)_PyTraceMalloc_GetTraces(void);
45+
46+
/* Clear tracemalloc traceback for an object */
47+
PyAPI_FUNC(PyObject*)_PyTraceMalloc_GetObjectTraceback(PyObject*obj);
48+
49+
/* Initialize tracemalloc */
50+
PyAPI_FUNC(int)_PyTraceMalloc_Init(void);
51+
52+
/* Start tracemalloc */
53+
PyAPI_FUNC(int)_PyTraceMalloc_Start(intmax_nframe);
54+
55+
/* Stop tracemalloc */
56+
PyAPI_FUNC(void)_PyTraceMalloc_Stop(void);
57+
58+
/* Get the tracemalloc traceback limit */
59+
PyAPI_FUNC(int)_PyTraceMalloc_GetTracebackLimit(void);
60+
61+
/* Get the memory usage of tracemalloc in bytes */
62+
PyAPI_FUNC(size_t)_PyTraceMalloc_GetMemory(void);
63+
64+
/* Get the current size and peak size of traced memory blocks as a 2-tuple */
65+
PyAPI_FUNC(PyObject*)_PyTraceMalloc_GetTracedMemory(void);
66+
67+
/* Set the peak size of traced memory blocks to the current size */
68+
PyAPI_FUNC(void)_PyTraceMalloc_ResetPeak(void);
69+
3670
#endif
3771

3872
#endif/* !Py_TRACEMALLOC_H */

‎Makefile.pre.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ PYTHON_OBJS=\
421421
Python/sysmodule.o \
422422
Python/thread.o \
423423
Python/traceback.o \
424+
Python/tracemalloc.o \
424425
Python/getopt.o \
425426
Python/pystrcmp.o \
426427
Python/pystrtod.o \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Move the core functionality of the ``tracemalloc`` module in the ``Python/``
2+
folder, leaving just the module wrapper in ``Modules/``.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp