public long computeTotalSize() {
    long result;
    long headAddr = topAddr;
    long addr;
    boolean concurrentModDetected;
    do {
      concurrentModDetected = false;
      result = 0;
      addr = headAddr;
      while (addr != 0L) {
        result += OffHeapStoredObject.getSize(addr);
        addr = OffHeapStoredObject.getNext(addr);
        testHookDoConcurrentModification();
        long curHead = topAddr;
        if (curHead != headAddr) {
          headAddr = curHead;
          concurrentModDetected = true;
          // Someone added or removed from the stack.
          // So we break out of the inner loop and start
          // again at the new head.
          break;
        }
      }
    } while (concurrentModDetected);
    return result;
  }
Removes all the addresses from this stack and returns the top address. The caller owns all the
addresses after this call.
geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapStoredObjectAddressStack.java