releaseLib static method

void releaseLib(
  1. String libName
)

Decrements the reference count for libName; drops the cached module at zero. The browser has no dlclose — dropping references lets the JS GC collect the instance once generated bridges release theirs.

Implementation

static void releaseLib(String libName) {
  final count = _libRefCount[libName];
  if (count == null || count <= 0) return;
  final next = count - 1;
  if (next == 0) {
    _libRefCount.remove(libName);
    _moduleCache.remove(libName);
    _log(NitroLogLevel.verbose, 'releaseLib', 'Released WASM module: $libName');
  } else {
    _libRefCount[libName] = next;
  }
}