Process-wide cap on outbound parked bytes shared by every WebTransport session.
Per-session caps (max_parked_bytes, default 64 MiB) bound one connection, but
nothing stopped N stalled sessions from multiplying that bound by N: 100 wedged
sessions could pin 6.4 GB of reference-counted binaries and OOM the node. This
budget is the shared ceiling for the whole VM.
Reservations use a single :atomics slot so the per-frame send path stays
lock-free (no GenServer round-trip in the hot loop). A reservation is taken when
a frame is enqueued and released as its bytes leave the queue, so the counter
always reflects live parked bytes.
nil is accepted everywhere as "no shared budget configured", which keeps a
standalone listener (tests, one-off scripts) working unchanged.
Summary
Functions
Builds a budget from a configured limit (0 or :infinity disables).
Returns the configured ceiling in bytes, or :infinity.
Creates a budget ceiling in bytes.
Releases bytes previously reserved against budget.
Reserves bytes against budget, returning :ok or :deny.
Returns the reserved bytes, or 0 when no budget is configured.
Types
@type t() :: {reference(), pos_integer()}
Functions
Builds a budget from a configured limit (0 or :infinity disables).
@spec limit(t() | nil) :: pos_integer() | :infinity
Returns the configured ceiling in bytes, or :infinity.
@spec new(pos_integer()) :: t()
Creates a budget ceiling in bytes.
@spec release(t() | nil, non_neg_integer()) :: :ok
Releases bytes previously reserved against budget.
@spec reserve(t() | nil, non_neg_integer()) :: :ok | :deny
Reserves bytes against budget, returning :ok or :deny.
@spec used(t() | nil) :: non_neg_integer()
Returns the reserved bytes, or 0 when no budget is configured.