summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-03-02 21:14:45 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-03-02 21:14:45 (GMT)
commit6fd92dc44f6bd6d0bb0308b298d21f181b083bd2 (patch)
treeb11799bfbb86c474c26cc08abf39f7b45b33f9da /Include
parentcb9426b5f4994c50f7981b9c3753ab7832917d25 (diff)
downloadcpython-6fd92dc44f6bd6d0bb0308b298d21f181b083bd2.zip
cpython-6fd92dc44f6bd6d0bb0308b298d21f181b083bd2.tar.gz
cpython-6fd92dc44f6bd6d0bb0308b298d21f181b083bd2.tar.bz2
Added words about what PyArena_Malloc() does.
Diffstat (limited to 'Include')
-rw-r--r--Include/pyarena.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/Include/pyarena.h b/Include/pyarena.h
index f5e9eb4..5f193fe 100644
--- a/Include/pyarena.h
+++ b/Include/pyarena.h
@@ -35,11 +35,23 @@ extern "C" {
PyAPI_FUNC(PyArena *) PyArena_New(void);
PyAPI_FUNC(void) PyArena_Free(PyArena *);
- PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t);
+ /* Mostly like malloc(), return the address of a block of memory spanning
+ * `size` bytes, or return NULL (without setting an exception) if enough
+ * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with
+ * size=0 does not guarantee to return a unique pointer (the pointer
+ * returned may equal one or more other pointers obtained from
+ * PyArena_Malloc()).
+ * Note that pointers obtained via PyArena_Malloc() must never be passed to
+ * the system free() or realloc(), or to any of Python's similar memory-
+ * management functions. PyArena_Malloc()-obtained pointers remain valid
+ * until PyArena_Free(ar) is called, at which point all pointers obtained
+ * from the arena `ar` become invalid simultaneously.
+ */
+ PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size);
- /* This routines isn't a proper arena allocation routine. It takes
- a PyObject* and records it so that it can be DECREFed when the
- arena is freed.
+ /* This routine isn't a proper arena allocation routine. It takes
+ * a PyObject* and records it so that it can be DECREFed when the
+ * arena is freed.
*/
PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *);