synchronized void removeReference(@NotNull PointerReference reference) {
    int index = reference.index;
    if (index < 0) return;

    if (references[index] != reference) {
      throw new AssertionError("At " + index + " expected " + reference + ", found " + references[index]);
    }
    references[index].index = -1;
    references[index] = null;
    size--;
  }
synchronized void removeReference(@NotNull PointerReference reference)