diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-05-02 20:31:14 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-05-02 20:31:14 (GMT) |
commit | db067af12a5ebb889874e47d8177f9c4a3dc9a68 (patch) | |
tree | 87cea7c1fb4a0905ac2632c03520c43f377b3584 /Include/objimpl.h | |
parent | d50c3f3f3af54f3be46d26d53a1c10b7c15a7b2d (diff) | |
download | cpython-db067af12a5ebb889874e47d8177f9c4a3dc9a68.zip cpython-db067af12a5ebb889874e47d8177f9c4a3dc9a68.tar.gz cpython-db067af12a5ebb889874e47d8177f9c4a3dc9a68.tar.bz2 |
Issue #21233: Add new C functions: PyMem_RawCalloc(), PyMem_Calloc(),
PyObject_Calloc(), _PyObject_GC_Calloc(). bytes(int) and bytearray(int) are now
using ``calloc()`` instead of ``malloc()`` for large objects which is faster
and use less memory (until the bytearray buffer is filled with data).
Diffstat (limited to 'Include/objimpl.h')
-rw-r--r-- | Include/objimpl.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Include/objimpl.h b/Include/objimpl.h index 3f21b70..65b6d91 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -95,6 +95,7 @@ PyObject_{New, NewVar, Del}. the raw memory. */ PyAPI_FUNC(void *) PyObject_Malloc(size_t size); +PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize); PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyObject_Free(void *ptr); @@ -321,7 +322,8 @@ extern PyGC_Head *_PyGC_generation0; (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) #endif /* Py_LIMITED_API */ -PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t); +PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t size); +PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size); PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *); PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t); PyAPI_FUNC(void) PyObject_GC_Track(void *); |