Exemple #1
0
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);
  }
}
Exemple #2
0
static long applyHeapDelta() {
  long newHeapSize = THAtomicAddLong(&heapSize, heapDelta) + heapDelta;
  heapDelta = 0;
  return newHeapSize;
}
Exemple #3
0
static long applyHeapDelta(THCState *state) {
  long newHeapSize = THAtomicAddLong(&heapSize, state->heapDelta) + state->heapDelta;
  state->heapDelta = 0;
  return newHeapSize;
}