MCPcopy Create free account
hub / github.com/pydata/numexpr / numexpr_set_tempsize

Function numexpr_set_tempsize

numexpr3/module.cpp:291–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289
290
291Py_ssize_t numexpr_set_tempsize(Py_ssize_t newSize) {
292
293 // printf( "DEBUG: setting temporary space to %d bytes.\n", newSize );
294 // The bytes of pre-allocated space for temporaries PER THREAD.
295 Py_ssize_t oldSize = gs.tempSize;
296 if( newSize <= 0) {
297 // Free space for hibernation
298 gs.tempSize = 0;
299 free( gs.tempArena );
300
301 } else if( oldSize <= 0 ) {
302 // Space was deallocated or never initialized.
303 gs.tempSize = newSize;
304 gs.tempArena = (char *)malloc(gs.tempSize);
305
306 } else {
307 // We can use realloc here.
308 gs.tempSize = newSize;
309 gs.tempArena = (char *)realloc(gs.tempArena, gs.tempSize);
310 }
311 return oldSize;
312}
313
314PyDoc_STRVAR(SetTempSize__doc__,
315"set_tempsize(int size) -- Sets the size of the temporary array arena. If you \

Callers 3

prepareSerialFunction · 0.85
prepareThreadsFunction · 0.85
PySet_tempsizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…