| | #ifndef Py_INTERNAL_PYMEM_H |
| | #define Py_INTERNAL_PYMEM_H |
| | #ifdef __cplusplus |
| | extern "C" { |
| | #endif |
| |
|
| | #ifndef Py_BUILD_CORE |
| | # error "this header requires Py_BUILD_CORE define" |
| | #endif |
| |
|
| | #include "pymem.h" |
| |
|
| |
|
| | |
| | |
| | |
| | PyAPI_FUNC(int) _PyMem_SetDefaultAllocator( |
| | PyMemAllocatorDomain domain, |
| | PyMemAllocatorEx *old_alloc); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | #define PYMEM_CLEANBYTE 0xCD |
| | #define PYMEM_DEADBYTE 0xDD |
| | #define PYMEM_FORBIDDENBYTE 0xFD |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | static inline int _PyMem_IsPtrFreed(const void *ptr) |
| | { |
| | uintptr_t value = (uintptr_t)ptr; |
| | #if SIZEOF_VOID_P == 8 |
| | return (value == 0 |
| | || value == (uintptr_t)0xCDCDCDCDCDCDCDCD |
| | || value == (uintptr_t)0xDDDDDDDDDDDDDDDD |
| | || value == (uintptr_t)0xFDFDFDFDFDFDFDFD); |
| | #elif SIZEOF_VOID_P == 4 |
| | return (value == 0 |
| | || value == (uintptr_t)0xCDCDCDCD |
| | || value == (uintptr_t)0xDDDDDDDD |
| | || value == (uintptr_t)0xFDFDFDFD); |
| | #else |
| | # error "unknown pointer size" |
| | #endif |
| | } |
| |
|
| | PyAPI_FUNC(int) _PyMem_GetAllocatorName( |
| | const char *name, |
| | PyMemAllocatorName *allocator); |
| |
|
| | |
| | |
| | |
| | PyAPI_FUNC(int) _PyMem_SetupAllocators(PyMemAllocatorName allocator); |
| |
|
| | struct _PyTraceMalloc_Config { |
| | |
| | |
| | enum { |
| | TRACEMALLOC_NOT_INITIALIZED, |
| | TRACEMALLOC_INITIALIZED, |
| | TRACEMALLOC_FINALIZED |
| | } initialized; |
| |
|
| | |
| | |
| | int tracing; |
| |
|
| | |
| | |
| | int max_nframe; |
| | }; |
| |
|
| | #define _PyTraceMalloc_Config_INIT \ |
| | {.initialized = TRACEMALLOC_NOT_INITIALIZED, \ |
| | .tracing = 0, \ |
| | .max_nframe = 1} |
| |
|
| | PyAPI_DATA(struct _PyTraceMalloc_Config) _Py_tracemalloc_config; |
| |
|
| |
|
| | #ifdef __cplusplus |
| | } |
| | #endif |
| | #endif |
| |
|