TS-2570: Reduce number of malloc/free in remap_stats fast path