jpayne@69: #ifndef Py_TRACEMALLOC_H jpayne@69: #define Py_TRACEMALLOC_H jpayne@69: jpayne@69: #ifndef Py_LIMITED_API jpayne@69: /* Track an allocated memory block in the tracemalloc module. jpayne@69: Return 0 on success, return -1 on error (failed to allocate memory to store jpayne@69: the trace). jpayne@69: jpayne@69: Return -2 if tracemalloc is disabled. jpayne@69: jpayne@69: If memory block is already tracked, update the existing trace. */ jpayne@69: PyAPI_FUNC(int) PyTraceMalloc_Track( jpayne@69: unsigned int domain, jpayne@69: uintptr_t ptr, jpayne@69: size_t size); jpayne@69: jpayne@69: /* Untrack an allocated memory block in the tracemalloc module. jpayne@69: Do nothing if the block was not tracked. jpayne@69: jpayne@69: Return -2 if tracemalloc is disabled, otherwise return 0. */ jpayne@69: PyAPI_FUNC(int) PyTraceMalloc_Untrack( jpayne@69: unsigned int domain, jpayne@69: uintptr_t ptr); jpayne@69: jpayne@69: /* Get the traceback where a memory block was allocated. jpayne@69: jpayne@69: Return a tuple of (filename: str, lineno: int) tuples. jpayne@69: jpayne@69: Return None if the tracemalloc module is disabled or if the memory block jpayne@69: is not tracked by tracemalloc. jpayne@69: jpayne@69: Raise an exception and return NULL on error. */ jpayne@69: PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback( jpayne@69: unsigned int domain, jpayne@69: uintptr_t ptr); jpayne@69: #endif jpayne@69: jpayne@69: #endif /* !Py_TRACEMALLOC_H */