MCPcopy Create free account
hub / github.com/numpy/numpy / PyDataMem_NEW

Function PyDataMem_NEW

numpy/core/src/multiarray/alloc.c:277–295  ·  view source on GitHub ↗

NUMPY_API * Allocates memory for array data. */

Source from the content-addressed store, hash-verified

275 * Allocates memory for array data.
276 */
277NPY_NO_EXPORT void *
278PyDataMem_NEW(size_t size)
279{
280 void *result;
281
282 assert(size != 0);
283 result = malloc(size);
284 if (_PyDataMem_eventhook != NULL) {
285 NPY_ALLOW_C_API_DEF
286 NPY_ALLOW_C_API
287 if (_PyDataMem_eventhook != NULL) {
288 (*_PyDataMem_eventhook)(NULL, result, size,
289 _PyDataMem_eventhook_user_data);
290 }
291 NPY_DISABLE_C_API
292 }
293 PyTraceMalloc_Track(NPY_TRACE_DOMAIN, (npy_uintp)result, size);
294 return result;
295}
296
297/*NUMPY_API
298 * Allocates zeroed memory for array data.

Callers 6

PyArray_LexSortFunction · 0.85
PyArray_ZeroFunction · 0.85
PyArray_OneFunction · 0.85
PyArray_ScalarFunction · 0.85
_set_constantFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected