void THCHeapUpdate(THCState *state, long size) { long newHeapSize = THAtomicAddLong(&heapSize, size) + size; #ifdef THC_CHECK_HEAP_UPDATE if (newHeapSize < 0) { THError("Internal error: THC heapSize < 0"); } #endif if (size > 0) { maybeTriggerGC(state, newHeapSize); } }
static long applyHeapDelta() { long newHeapSize = THAtomicAddLong(&heapSize, heapDelta) + heapDelta; heapDelta = 0; return newHeapSize; }
static long applyHeapDelta(THCState *state) { long newHeapSize = THAtomicAddLong(&heapSize, state->heapDelta) + state->heapDelta; state->heapDelta = 0; return newHeapSize; }