The default data mem allocator calloc routine does not make use of a ctx. It should be called only through PyDataMem_UserNEW_ZEROED since itself does not handle eventhook and tracemalloc logic.
| 374 | // It should be called only through PyDataMem_UserNEW_ZEROED |
| 375 | // since itself does not handle eventhook and tracemalloc logic. |
| 376 | static inline void * |
| 377 | default_calloc(void *NPY_UNUSED(ctx), size_t nelem, size_t elsize) |
| 378 | { |
| 379 | void * p; |
| 380 | size_t sz = nelem * elsize; |
| 381 | NPY_BEGIN_THREADS_DEF; |
| 382 | if (sz < NBUCKETS) { |
| 383 | p = _npy_alloc_cache(sz, 1, NBUCKETS, datacache, &malloc); |
| 384 | if (p) { |
| 385 | memset(p, 0, sz); |
| 386 | } |
| 387 | return p; |
| 388 | } |
| 389 | NPY_BEGIN_THREADS; |
| 390 | p = calloc(nelem, elsize); |
| 391 | NPY_END_THREADS; |
| 392 | return p; |
| 393 | } |
| 394 | |
| 395 | // The default data mem allocator realloc routine does not make use of a ctx. |
| 396 | // It should be called only through PyDataMem_UserRENEW |
nothing calls this directly
no test coverage detected