Skip to content

Commit 38c9920

Browse files
committed
add in PyMem calls rather than stdlib malloc/free
1 parent b69c759 commit 38c9920

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/hashtable.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from cpython cimport PyObject, Py_INCREF, PyList_Check, PyTuple_Check
44

55
from khash cimport *
66
from numpy cimport *
7-
from libc.stdlib cimport malloc, free
7+
from cpython cimport PyMem_Malloc, PyMem_Realloc, PyMem_Free
88

99
from util cimport _checknan
1010
cimport util
@@ -103,7 +103,7 @@ cdef class Int64Vector:
103103
ndarray ao
104104

105105
def __cinit__(self):
106-
self.data = <Int64VectorData *>malloc(sizeof(Int64VectorData))
106+
self.data = <Int64VectorData *>PyMem_Malloc(sizeof(Int64VectorData))
107107
self.data.n = 0
108108
self.data.m = _INIT_VEC_CAP
109109
self.ao = np.empty(self.data.m, dtype=np.int64)
@@ -115,7 +115,7 @@ cdef class Int64Vector:
115115
self.data.data = <int64_t*> self.ao.data
116116

117117
def __dealloc__(self):
118-
free(self.data)
118+
PyMem_Free(self.data)
119119

120120
def __len__(self):
121121
return self.data.n

0 commit comments

Comments
 (0)