Commit 62f66698 authored by John Kirkham's avatar John Kirkham

Define Raw memory functions near non-Raw ones

parent 8d324dfd
from cpython.version cimport PY_VERSION_HEX from cpython.version cimport PY_VERSION_HEX
cdef extern from *:
void* PyMem_RawMalloc(size_t n) nogil
void* PyMem_RawRealloc(void *p, size_t n) nogil
void PyMem_RawFree(void *p) nogil
cdef extern from "Python.h": cdef extern from "Python.h":
##################################################################### #####################################################################
...@@ -34,6 +29,7 @@ cdef extern from "Python.h": ...@@ -34,6 +29,7 @@ cdef extern from "Python.h":
# available for allocating and releasing memory from the Python # available for allocating and releasing memory from the Python
# heap: # heap:
void* PyMem_RawMalloc(size_t n) nogil
void* PyMem_Malloc(size_t n) void* PyMem_Malloc(size_t n)
# Allocates n bytes and returns a pointer of type void* to the # Allocates n bytes and returns a pointer of type void* to the
# allocated memory, or NULL if the request fails. Requesting zero # allocated memory, or NULL if the request fails. Requesting zero
...@@ -41,6 +37,7 @@ cdef extern from "Python.h": ...@@ -41,6 +37,7 @@ cdef extern from "Python.h":
# PyMem_Malloc(1) had been called instead. The memory will not # PyMem_Malloc(1) had been called instead. The memory will not
# have been initialized in any way. # have been initialized in any way.
void* PyMem_RawRealloc(void *p, size_t n) nogil
void* PyMem_Realloc(void *p, size_t n) void* PyMem_Realloc(void *p, size_t n)
# Resizes the memory block pointed to by p to n bytes. The # Resizes the memory block pointed to by p to n bytes. The
# contents will be unchanged to the minimum of the old and the new # contents will be unchanged to the minimum of the old and the new
...@@ -50,6 +47,7 @@ cdef extern from "Python.h": ...@@ -50,6 +47,7 @@ cdef extern from "Python.h":
# NULL, it must have been returned by a previous call to # NULL, it must have been returned by a previous call to
# PyMem_Malloc() or PyMem_Realloc(). # PyMem_Malloc() or PyMem_Realloc().
void PyMem_RawFree(void *p) nogil
void PyMem_Free(void *p) void PyMem_Free(void *p)
# Frees the memory block pointed to by p, which must have been # Frees the memory block pointed to by p, which must have been
# returned by a previous call to PyMem_Malloc() or # returned by a previous call to PyMem_Malloc() or
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment