Conversation
Reduce idle TCP backing retention and the minimum first-send allocation under the existing with_low_memory build convention. Preserve default-build constants, flow control, live payload ownership and automatic growth. Avoid an undersized small spare creating a 16 KiB tail allocation. Add focused cache/reuse regression coverage, memory-profile benchmarks and physical-iPad comparison results with their workload and CPU-cost limits. Validation: root race and vet pass in both build modes. Full gVisor interop passes serially without race at GOMAXPROCS=2. Concurrent full interop race runs at GOMAXPROCS=4 timed out in both modes; this remains unresolved and is documented rather than counted as a pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hako already uses
with_low_memoryfor its iOS/tvOS core slices. Its iOSpacket-tunnel extension targets a 50 MiB engineering budget, but shrinking
configured TCP window limits alone does not release backing retained by
idle connections. This change makes MIPS honor the existing build tag for
TCP storage retention, without adding a runtime API.
Changes
16 KiB chunk for a small write's tail. Allocate one fitted first chunk instead.
Automatic receive/send growth, advertised windows, active data, socket
options and retransmission behavior retain their existing semantics.
Common payload/metadata reuse remains enabled. Ordinary builds keep the
existing constants; the extra small-spare condition compiles out.
iPad evidence
An independent Debug App on a physical iPad Pro ran three fresh-process
repetitions per build, with alternating baseline/candidate order. Two MIPS
stacks maintained 256 connection pairs using Hako's 32 KiB initial / 128 KiB
maximum socket settings. The workload included tiny messages, ordinary small
messages, repeated 32 KiB messages, latency samples, and an identical 1 GiB
bidirectional payload transfer. All six runs completed and all connections
still transferred after the stream.
Throughput uses decimal Gbps (10^9 bits/s) and counts both echoed payload
directions. For this symmetric echo workload, each direction therefore
accounts for approximately 1.31 and 1.35 Gbps, respectively. These are not
separate upload/download saturation tests and cannot be compared directly
with one-way benchmark charts.
The approximately 8.11 MiB live-heap saving is specific to the repeated-32-KiB
workload and its 512 TCP endpoints. CPU cost and allocation traffic per byte
increased by about 4%. The throughput/latency sample does not establish a speed
improvement. Both arms used explicit GC for idle accounting; the implementation
never forces GC. This is App process evidence, not NetworkExtension, PacketFlow,
Internet, battery, or extension termination-risk evidence.
Validation
in serial, non-race runs (rechecked during review).
spare edge case, then passed with the implementation.
after address-relocation normalization on Go 1.26.5 darwin/arm64.
No stack or connection fields were added. This is not whole-binary identity
or a performance guarantee for every compiler/architecture.
During the latest review, both complete gVisor race suites were run
concurrently with GOMAXPROCS=4. Both encountered IPv4 MTU-68 and some
custom-congestion-control timeouts and eventually exceeded the three-minute
suite limit. The root-module race suites passed for both builds. The complete
interop race result is unresolved and is not reported as green.
Earlier MTU-68 instability also reproduced on the unmodified baseline. This
does not establish the cause of the latest failures; this patch does not
claim to resolve them. Serial non-race passes are not a substitute for race
passes.
See
LOW_MEMORY.mdfor the policy, reproduction details, measurements andlimitations. Baseline:
ba762df4c91d6f9bddf82062afb0d40aa1352687.