Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/python3.12/tracemalloc.h
1 #ifndef Py_TRACEMALLOC_H 2 #define Py_TRACEMALLOC_H 3 #ifndef Py_LIMITED_API 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 /* Track an allocated memory block in the tracemalloc module. 9 Return 0 on success, return -1 on error (failed to allocate memory to store 10 the trace). 11 12 Return -2 if tracemalloc is disabled. 13 14 If memory block is already tracked, update the existing trace. */ 15 PyAPI_FUNC(int) PyTraceMalloc_Track( 16 unsigned int domain, 17 uintptr_t ptr, 18 size_t size); 19 20 /* Untrack an allocated memory block in the tracemalloc module. 21 Do nothing if the block was not tracked. 22 23 Return -2 if tracemalloc is disabled, otherwise return 0. */ 24 PyAPI_FUNC(int) PyTraceMalloc_Untrack( 25 unsigned int domain, 26 uintptr_t ptr); 27 28 /* Get the traceback where a memory block was allocated. 29 30 Return a tuple of (filename: str, lineno: int) tuples. 31 32 Return None if the tracemalloc module is disabled or if the memory block 33 is not tracked by tracemalloc. 34 35 Raise an exception and return NULL on error. */ 36 PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback( 37 unsigned int domain, 38 uintptr_t ptr); 39 40 /* Return non-zero if tracemalloc is tracing */ 41 PyAPI_FUNC(int) _PyTraceMalloc_IsTracing(void); 42 43 /* Clear the tracemalloc traces */ 44 PyAPI_FUNC(void) _PyTraceMalloc_ClearTraces(void); 45 46 /* Clear the tracemalloc traces */ 47 PyAPI_FUNC(PyObject *) _PyTraceMalloc_GetTraces(void); 48 49 /* Clear tracemalloc traceback for an object */ 50 PyAPI_FUNC(PyObject *) _PyTraceMalloc_GetObjectTraceback(PyObject *obj); 51 52 /* Initialize tracemalloc */ 53 PyAPI_FUNC(PyStatus) _PyTraceMalloc_Init(void); 54 55 /* Start tracemalloc */ 56 PyAPI_FUNC(int) _PyTraceMalloc_Start(int max_nframe); 57 58 /* Stop tracemalloc */ 59 PyAPI_FUNC(void) _PyTraceMalloc_Stop(void); 60 61 /* Get the tracemalloc traceback limit */ 62 PyAPI_FUNC(int) _PyTraceMalloc_GetTracebackLimit(void); 63 64 /* Get the memory usage of tracemalloc in bytes */ 65 PyAPI_FUNC(size_t) _PyTraceMalloc_GetMemory(void); 66 67 /* Get the current size and peak size of traced memory blocks as a 2-tuple */ 68 PyAPI_FUNC(PyObject *) _PyTraceMalloc_GetTracedMemory(void); 69 70 /* Set the peak size of traced memory blocks to the current size */ 71 PyAPI_FUNC(void) _PyTraceMalloc_ResetPeak(void); 72 73 #ifdef __cplusplus 74 } 75 #endif 76 #endif /* !Py_LIMITED_API */ 77 #endif /* !Py_TRACEMALLOC_H */