releaseUnsentAdoptedNativePayloads function

void releaseUnsentAdoptedNativePayloads(
  1. WorkerResponse response
)

Frees adopted mallocs that were never delivered to another isolate.

Implementation

void releaseUnsentAdoptedNativePayloads(WorkerResponse response) {
  switch (response) {
    case QueryResponse(:final adoptedNative):
      if (adoptedNative != null) {
        releaseAdoptedNativePayload(adoptedNative);
      }
    case StreamFetchResponse(:final adoptedNative):
      if (adoptedNative != null) {
        releaseAdoptedNativePayload(adoptedNative);
      }
    case StreamPollFetchResponse(:final adoptedNative):
      if (adoptedNative != null) {
        releaseAdoptedNativePayload(adoptedNative);
      }
    default:
      break;
  }
}