Repository navigation
fix(native-sidecar): return freed memory to the OS after VM disposal - #2074
Open
eersnington wants to merge 1 commit into
Open
eersnington wants to merge 1 commit into
eersnington wants to merge 1 commit into
Conversation
Contributor
📟 Pip-Boy ·
|
| check | new in this PR | fixed | existing on base |
|---|---|---|---|
| advisories | ✅ 0 | 0 | 25 |
| licenses | ✅ 0 | 0 | 0 |
| sources | ✅ 0 | 0 | 0 |
| bans | ✅ 0 | 0 | 0 |
| unused | ✅ 0 | 0 | 16 |
🦀 Binaries · publish Dockerfiles, --release
Base: main@9413c84, the merge base.
| artifact | npm @latest |
base | this PR | Δ vs base |
|---|---|---|---|---|
agentos-native-sidecar darwin-arm64 |
120.1 MB | 120.1 MB | 120.1 MB | +912 B (+0.0%) |
agentos-native-sidecar darwin-x64 |
129.6 MB | 129.6 MB | 129.6 MB | −2.8 KB (−0.0%) |
agentos-native-sidecar linux-arm64-gnu |
140.8 MB | 140.8 MB | 140.8 MB | −7.9 KB (−0.0%) |
agentos-native-sidecar linux-x64-gnu |
143.6 MB | 143.7 MB | 143.8 MB | +50.0 KB (+0.0%) |
⏱ Timing
| job | wall time | slowest step |
|---|---|---|
changes |
31s | checkout · 28s |
zizmor |
9s | checkout · 2s |
hygiene |
1m04s | checkout · 31s |
native · linux-x64-gnu |
14m04s | Build with the publish Dockerfile · 13m35s |
native · darwin-arm64 |
9m00s | Build with the publish Dockerfile · 8m44s |
native · darwin-x64 |
10m36s | Build with the publish Dockerfile · 10m14s |
native · linux-arm64-gnu |
10m14s | Build with the publish Dockerfile · 9m55s |
⏭ self-test |
— | skipped |
⏭ footprint |
— | skipped |
report |
22s | setup-node · 6s |
🔭 Full CI trace for this commit
One OpenTelemetry trace of CI and Pip-Boy for ea97e53: every job and step, with the sizes above attached. Run after CI finishes.
pnpm install --frozen-lockfile --filter 'pipboy...'
pnpm --filter pipboy pipboy trace --sha ea97e53fb1ffee2c9affdbaa0e1ef7618a2c33ffAdd --otlp <url> to send it to any OTLP/HTTP collector.
Agent instruction: From a rivet-dev/agentos checkout, run the commands above, then read the trace file the last command prints. List the slowest jobs and steps and explain where CI time went.
glibc keeps pages freed by a disposed VM's V8 isolates mapped in its arenas, so a long-lived sidecar's RSS only grows. After VM disposal the sidecar now runs one coalesced malloc_trim(0) per second on the shared blocking executor, off the hot path. Linux with glibc only; other targets compile it as a no-op.
eersnington
force-pushed
the
fix/native-heap-release
branch
from
October 21, 2026 16:49
e348728 to
ea97e53
Compare
This branch has not been deployed
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.
Fixes #1902.
The sidecar's memory only grew as VMs came and went: glibc keeps pages freed by a disposed VM's V8 isolates mapped in its arenas.
malloc_trim(0)per second on the existing blocking executor, off the hot path and without holding locks.resource-limits.mdxdocuments sidecar memory and the warm isolate pool cost (about 20 MiB per isolate,AGENTOS_V8_WARM_ISOLATES).mainevaluatep99 while other VMs churnAn earlier revision also pinned glibc's
M_MMAP_THRESHOLDat 128 KiB. It made allocation-heavy guest code and loopback TCP 3 to 6 times slower, for little extra memory, so this revision removes it.