+
+ // No finalizers to run?
+ if (n == 0) return;
+
+ IF_DEBUG(weak,fprintf(stderr,"weak: batching %d finalizers\n", n));
+
+ arr = (StgMutArrPtrs *)allocate(sizeofW(StgMutArrPtrs) + n);
+ TICK_ALLOC_PRIM(sizeofW(StgMutArrPtrs), n, 0);
+ SET_HDR(arr, &stg_MUT_ARR_PTRS_FROZEN_info, CCS_SYSTEM);
+ arr->mut_link = NULL;
+ arr->ptrs = n;
+
+ n = 0;
+ for (w = list; w; w = w->link) {
+ if (w->finalizer != &stg_NO_FINALIZER_closure) {
+ arr->payload[n] = w->finalizer;
+ n++;
+ }
+ }