Repository navigation
Conversation
Attach Run's doc comment to Run again, assert heap_bytes by its bounds instead of an exact size, and say in the README that it measures only with max_heap_bytes.
…ut a heap limit The heap meter now runs with a limit, with measure_heap, or both: a limit keeps its own schedule and check, and measure_heap measures at the run's waits for the host once it allocated a sixteenth of what it last reached. A limit alone no longer measures at the first wait.
# Conflicts: # rust/crates/psychoscript/src/runtime.rs
…at resumes with one A state saved without measure_heap or a limit and resumed with measure_heap counted the lazy groups set up before the suspend as program bytes.
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.
What
Run::heap_bytes(&self) -> Option<u64>. It is always available (nogc-statsfeature) and is backed by anArc<AtomicU64>onRun.Vm::heap_measureresult to it, in the shared size model ofheap.rs, including the measurement of an over-limit stop.max_heap_bytesis set and nothing has been measured yet (Vm::heap_wait). A long-lived idle run then reports its reachable bytes, and later waits pay for no measurement.rust/README.mdunder "Only Rust has".Why
The OpenCode Rust client reports the live heap of an idle plugin in production builds. Today that number needs the benchmark-only
gc-statsfeature.Upstream
Rebased cleanly onto
origin/dev(dec90d1; tip3346c0d, 0 conflicts). Nothing was superseded by merged upstream work.Compared with open PRs:
6b12d56, count heap BigInts towardmax_heap_bytes), fix(rust): count each live string allocation toward max_heap_bytes #115 (b150db5, count each live string allocation), perf(rust): zero-alloc thread CPU clock reads and trailing heap chunk reclamation #154 (fa33011, trailing heap chunk reclamation), and fix(rust): ephemeron WeakMap/WeakSet GC, MAX_STRINGS reuse, and dynamic atom heap accounting #155 (0a3fe9e, ephemeron WeakMap/WeakSet GC and dynamic atom heap accounting) all change whatheap::measureaccounts for or how heap chunks are reclaimed;Run::heap_bytessimply publishes whateverheap::measurereturns, so they are complementary. perf(rust): zero-alloc thread CPU clock reads and trailing heap chunk reclamation #154 merges cleanly (0 conflicts); fix(rust): count heap BigInt allocations toward max_heap_bytes #114, fix(rust): count each live string allocation toward max_heap_bytes #115, and fix(rust): ephemeron WeakMap/WeakSet GC, MAX_STRINGS reuse, and dynamic atom heap accounting #155 each append tests to the end ofrust/crates/psychoscript/tests/heap.rs, so whichever lands later has a trivial end-of-file textual conflict there.880f23f) addsSession::memory_bytes(&self) -> usize, which runs an on-demandheap::measure(&self.vm)between synchronousSession::call_fninvocations.Run::heap_bytesis for live asyncProgramruns (a lock-freeAtomicU64readable from host callbacks or outside the run without&Vm). They merge with 0 conflicts.Tests
run_heap_bytes_reports_last_measured_reachable_bytes_without_gc_statsinrust/crates/psychoscript/tests/heap.rs:Nonewithoutmax_heap_bytes, the first-wait measurement of an idle run, an update on growth past the pacing threshold, the exact 16,064 bytes of the shared size model, and the value recorded by an over-limit stop.cargo fmt --all --check,cargo clippy --locked --workspace --all-targets -- -D warnings,cargo clippy --locked -p psychoscript --no-default-features --all-targets -- -D warnings,cargo test --locked -p psychoscript(includingtests/heap.rs12/12; two timing-sensitivetests/clock.rstests flaked under tux'snice -n 19/CPUQuota=400%load;tests/hostile.rspassed on rerun), andcargo test --locked -p psychoscript --no-default-features --test locale_fallback --test heappass.Review changes: merged
dev; addedRuntime::measure_heap(true), which reuses the heap meter without a limit and measures at waits for the host once the run has allocated 1/16 of its last measurement; a limit keepsdev's schedule, so it no longer adds the first-wait measurement;UNMEASUREDno longer takesRun's doc comment; the tests check bounds instead of 16,064 and cover round-trip mode and a mid-run suspend/resume; lazy built-ins are recorded with or without a meter, so a state saved without the opt-in measures the same once resumed with it; README updated, including that the reading can lag after a big drop.