ReviewOS

zig-utils/zig-js

Intl: release NumberFormat structural part scratch after result materialization

#640
Closed chris opened this 9 days ago ·
9 days ago

Problem

NfOutput appends formatToParts metadata and translated digit buffers directly to the Context arena. NumberFormat, range formatting, and DurationFormat copy those parts into managed JavaScript strings, but the intermediate allocations remain retained for the Context lifetime. Under the bounded-heap recovery witness this becomes the next deterministic OOM after #638 and #639 remove the outer RelativeTimeFormat and DurationFormat scratch layers.

Required change

  • Give structural NumberFormat output explicit invocation-local ownership.
  • Keep part values alive through range comparison/list assembly and nested DurationFormat flattening.
  • Reclaim all metadata and translated-digit storage immediately after the managed result is materialized.
  • Preserve failure atomicity and do not raise heap budgets or weaken the recovery witness.

Acceptance evidence

  • Focused normal and TSan bounded-heap recovery witness.
  • NumberFormat unit coverage, including formatToParts/range/non-Latin digits and allocation-failure injection.
  • test/intl402/NumberFormat before → after with no regressions.
  • Full exact unit shard containing the recovery witness.

Related: #475, #480, #636, #638, #639.

9 days ago

2d7452db gives NumberFormat structural output one invocation-local owner covering part metadata, translated digits, decimal buffers, and range rebuilds. Focused normal/TSan allocation-failure coverage is clean; all 15 NumberFormat units pass; Test262 NumberFormat remains 249 pass, 0 fail. Fresh Linux CI is pending.

9 days ago

Closing with fresh Linux run 32388315489: the unchanged bounded Intl structural-parts witness passed in unit shard 0 and TSan unit shard 0, with zero failures/leaks in both shards. NumberFormat Test262 remained 249/249 (0 flips).

Sign in to comment on this issue.