mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-30054: Expose tracemalloc C API (#1236)
* Make PyTraceMalloc_Track() and PyTraceMalloc_Untrack() functions public (remove the "_" prefix) * Remove the _PyTraceMalloc_domain_t type: use directly unsigned int. * Document methods Note: methods are already tested in test_tracemalloc.
This commit is contained in:
parent
26cb4657bc
commit
5ea4c06773
5 changed files with 55 additions and 23 deletions
|
@ -25,9 +25,6 @@ PyAPI_FUNC(int) _PyMem_SetupAllocators(const char *opt);
|
|||
PyAPI_FUNC(int) _PyMem_PymallocEnabled(void);
|
||||
#endif
|
||||
|
||||
/* Identifier of an address space (domain) in tracemalloc */
|
||||
typedef unsigned int _PyTraceMalloc_domain_t;
|
||||
|
||||
/* Track an allocated memory block in the tracemalloc module.
|
||||
Return 0 on success, return -1 on error (failed to allocate memory to store
|
||||
the trace).
|
||||
|
@ -35,8 +32,8 @@ typedef unsigned int _PyTraceMalloc_domain_t;
|
|||
Return -2 if tracemalloc is disabled.
|
||||
|
||||
If memory block is already tracked, update the existing trace. */
|
||||
PyAPI_FUNC(int) _PyTraceMalloc_Track(
|
||||
_PyTraceMalloc_domain_t domain,
|
||||
PyAPI_FUNC(int) PyTraceMalloc_Track(
|
||||
unsigned int domain,
|
||||
uintptr_t ptr,
|
||||
size_t size);
|
||||
|
||||
|
@ -44,8 +41,8 @@ PyAPI_FUNC(int) _PyTraceMalloc_Track(
|
|||
Do nothing if the block was not tracked.
|
||||
|
||||
Return -2 if tracemalloc is disabled, otherwise return 0. */
|
||||
PyAPI_FUNC(int) _PyTraceMalloc_Untrack(
|
||||
_PyTraceMalloc_domain_t domain,
|
||||
PyAPI_FUNC(int) PyTraceMalloc_Untrack(
|
||||
unsigned int domain,
|
||||
uintptr_t ptr);
|
||||
|
||||
/* Get the traceback where a memory block was allocated.
|
||||
|
@ -57,7 +54,7 @@ PyAPI_FUNC(int) _PyTraceMalloc_Untrack(
|
|||
|
||||
Raise an exception and return NULL on error. */
|
||||
PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback(
|
||||
_PyTraceMalloc_domain_t domain,
|
||||
unsigned int domain,
|
||||
uintptr_t ptr);
|
||||
#endif /* !Py_LIMITED_API */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue