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

Function PyDataMem_RENEW

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

NUMPY_API * Reallocate/resize memory for array data. */

Source from the content-addressed store, hash-verified

339 * Reallocate/resize memory for array data.
340 */
341NPY_NO_EXPORT void *
342PyDataMem_RENEW(void *ptr, size_t size)
343{
344 void *result;
345
346 assert(size != 0);
347 result = realloc(ptr, size);
348 if (result != ptr) {
349 PyTraceMalloc_Untrack(NPY_TRACE_DOMAIN, (npy_uintp)ptr);
350 }
351 PyTraceMalloc_Track(NPY_TRACE_DOMAIN, (npy_uintp)result, size);
352 if (_PyDataMem_eventhook != NULL) {
353 NPY_ALLOW_C_API_DEF
354 NPY_ALLOW_C_API
355 if (_PyDataMem_eventhook != NULL) {
356 (*_PyDataMem_eventhook)(ptr, result, size,
357 _PyDataMem_eventhook_user_data);
358 }
359 NPY_DISABLE_C_API
360 }
361 return result;
362}
363
364// The default data mem allocator malloc routine does not make use of a ctx.
365// It should be called only through PyDataMem_UserNEW

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected