#ifndef Py_INTERNAL_OBJECT_ALLOC_H
#define Py_INTERNAL_OBJECT_ALLOC_H
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "pycore_tstate.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif
#ifdef Py_GIL_DISABLED
static inline mi_heap_t *
_PyObject_GetAllocationHeap(_PyThreadStateImpl *tstate, PyTypeObject *tp)
{
struct _mimalloc_thread_state *m = &tstate->mimalloc;
if (_PyType_HasFeature(tp, Py_TPFLAGS_PREHEADER)) {
return &m->heaps[_Py_MIMALLOC_HEAP_GC_PRE];
}
else if (_PyType_IS_GC(tp)) {
return &m->heaps[_Py_MIMALLOC_HEAP_GC];
}
else {
return &m->heaps[_Py_MIMALLOC_HEAP_OBJECT];
}
}
#endif
static inline void *
_PyObject_MallocWithType(PyTypeObject *tp, size_t size)
{ … }
static inline void *
_PyObject_ReallocWithType(PyTypeObject *tp, void *ptr, size_t size)
{ … }
#ifdef __cplusplus
}
#endif
#endif