public static void returnNode(BSPNode node) {
    cache[tail++] = node;
    if (tail == CACHE_SIZE) {
      tail = 0;
    }
    size = Math.min(size + 1, CACHE_SIZE);

    if (node.getLeft() != null || node.getRight() != null) {
      throw new RuntimeException("HHHHH!");
    }
  }