release method

int? release(
  1. TKey key
)

Releases key's nid back to the pool and returns it, or null if key was not registered. Callers must zero their per-nid arrays at the returned nid so a future allocate that recycles the slot sees a clean state.

Implementation

int? release(TKey key) {
  final nid = _keyToNid.remove(key);
  if (nid == null) {
    return null;
  }
  _nidToKey[nid] = null;
  _freeNids.add(nid);
  return nid;
}