Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:46

0001 #ifndef Py_INTERNAL_PYMEM_INIT_H
0002 #define Py_INTERNAL_PYMEM_INIT_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006 
0007 #ifndef Py_BUILD_CORE
0008 #  error "this header requires Py_BUILD_CORE define"
0009 #endif
0010 
0011 #include "pycore_pymem.h"
0012 
0013 
0014 /********************************/
0015 /* the allocators' initializers */
0016 
0017 extern void * _PyMem_RawMalloc(void *, size_t);
0018 extern void * _PyMem_RawCalloc(void *, size_t, size_t);
0019 extern void * _PyMem_RawRealloc(void *, void *, size_t);
0020 extern void _PyMem_RawFree(void *, void *);
0021 #define PYRAW_ALLOC {NULL, _PyMem_RawMalloc, _PyMem_RawCalloc, _PyMem_RawRealloc, _PyMem_RawFree}
0022 
0023 #ifdef WITH_PYMALLOC
0024 extern void* _PyObject_Malloc(void *, size_t);
0025 extern void* _PyObject_Calloc(void *, size_t, size_t);
0026 extern void _PyObject_Free(void *, void *);
0027 extern void* _PyObject_Realloc(void *, void *, size_t);
0028 #  define PYOBJ_ALLOC {NULL, _PyObject_Malloc, _PyObject_Calloc, _PyObject_Realloc, _PyObject_Free}
0029 #else
0030 # define PYOBJ_ALLOC PYRAW_ALLOC
0031 #endif  // WITH_PYMALLOC
0032 
0033 #define PYMEM_ALLOC PYOBJ_ALLOC
0034 
0035 extern void* _PyMem_DebugRawMalloc(void *, size_t);
0036 extern void* _PyMem_DebugRawCalloc(void *, size_t, size_t);
0037 extern void* _PyMem_DebugRawRealloc(void *, void *, size_t);
0038 extern void _PyMem_DebugRawFree(void *, void *);
0039 
0040 extern void* _PyMem_DebugMalloc(void *, size_t);
0041 extern void* _PyMem_DebugCalloc(void *, size_t, size_t);
0042 extern void* _PyMem_DebugRealloc(void *, void *, size_t);
0043 extern void _PyMem_DebugFree(void *, void *);
0044 
0045 #define PYDBGRAW_ALLOC(runtime) \
0046     {&(runtime).allocators.debug.raw, _PyMem_DebugRawMalloc, _PyMem_DebugRawCalloc, _PyMem_DebugRawRealloc, _PyMem_DebugRawFree}
0047 #define PYDBGMEM_ALLOC(runtime) \
0048     {&(runtime).allocators.debug.mem, _PyMem_DebugMalloc, _PyMem_DebugCalloc, _PyMem_DebugRealloc, _PyMem_DebugFree}
0049 #define PYDBGOBJ_ALLOC(runtime) \
0050     {&(runtime).allocators.debug.obj, _PyMem_DebugMalloc, _PyMem_DebugCalloc, _PyMem_DebugRealloc, _PyMem_DebugFree}
0051 
0052 extern void * _PyMem_ArenaAlloc(void *, size_t);
0053 extern void _PyMem_ArenaFree(void *, void *, size_t);
0054 
0055 #ifdef Py_DEBUG
0056 # define _pymem_allocators_standard_INIT(runtime) \
0057     { \
0058         PYDBGRAW_ALLOC(runtime), \
0059         PYDBGMEM_ALLOC(runtime), \
0060         PYDBGOBJ_ALLOC(runtime), \
0061     }
0062 #else
0063 # define _pymem_allocators_standard_INIT(runtime) \
0064     { \
0065         PYRAW_ALLOC, \
0066         PYMEM_ALLOC, \
0067         PYOBJ_ALLOC, \
0068     }
0069 #endif
0070 
0071 #define _pymem_allocators_debug_INIT \
0072    { \
0073        {'r', PYRAW_ALLOC}, \
0074        {'m', PYMEM_ALLOC}, \
0075        {'o', PYOBJ_ALLOC}, \
0076    }
0077 
0078 #  define _pymem_allocators_obj_arena_INIT \
0079     { NULL, _PyMem_ArenaAlloc, _PyMem_ArenaFree }
0080 
0081 
0082 #ifdef __cplusplus
0083 }
0084 #endif
0085 #endif  // !Py_INTERNAL_PYMEM_INIT_H