summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-01-20 16:14:45 (GMT)
committerGitHub <noreply@github.com>2024-01-20 16:14:45 (GMT)
commit1d6d5e854c375821a64fa9c2fbb04a36fb3b9aaa (patch)
tree4bd78a9aca8990260d29c54202249936b685a5c6 /Objects
parentb1ad5a5d446f944a45c43a3e865d1d8f47611071 (diff)
downloadcpython-1d6d5e854c375821a64fa9c2fbb04a36fb3b9aaa.zip
cpython-1d6d5e854c375821a64fa9c2fbb04a36fb3b9aaa.tar.gz
cpython-1d6d5e854c375821a64fa9c2fbb04a36fb3b9aaa.tar.bz2
gh-112529: Use GC heaps for GC allocations in free-threaded builds (gh-114157)
* gh-112529: Use GC heaps for GC allocations in free-threaded builds The free-threaded build's garbage collector implementation will need to find GC objects by traversing mimalloc heaps. This hooks up the allocation calls with the correct heaps by using a thread-local "current_obj_heap" variable. * Refactor out setting heap based on type
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index ea29a38..3a35a5b 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -11,6 +11,7 @@
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
#include "pycore_moduleobject.h" // _PyModule_GetDef()
#include "pycore_object.h" // _PyType_HasFeature()
+#include "pycore_object_alloc.h" // _PyObject_MallocWithType()
#include "pycore_pyerrors.h" // _PyErr_Occurred()
#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_symtable.h" // _Py_Mangle()
@@ -1729,7 +1730,7 @@ _PyType_AllocNoTrack(PyTypeObject *type, Py_ssize_t nitems)
const size_t size = _PyObject_VAR_SIZE(type, nitems+1);
const size_t presize = _PyType_PreHeaderSize(type);
- char *alloc = PyObject_Malloc(size + presize);
+ char *alloc = _PyObject_MallocWithType(type, size + presize);
if (alloc == NULL) {
return PyErr_NoMemory();
}