From 817e680d5936d7c77e1db82f9d6e1f4b8a88d80e Mon Sep 17 00:00:00 2001 From: darmie Date: Sun, 27 Sep 2026 14:30:25 +0000 Subject: [PATCH 1/2] Python memory pressure: confirm growth with a longer run before calling it a leak Growth past the allowance between the short and the long run is checked against a third run four times longer; a warm-up that has finished by the long run stops there, and only continued growth fails. --- crates/zyntax_python/tests/memory_pressure.rs | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/crates/zyntax_python/tests/memory_pressure.rs b/crates/zyntax_python/tests/memory_pressure.rs index c8d26599..656b3c57 100644 --- a/crates/zyntax_python/tests/memory_pressure.rs +++ b/crates/zyntax_python/tests/memory_pressure.rs @@ -7,7 +7,10 @@ //! run twice, at a small count and at one many times larger; the //! difference in peak resident memory between the two is what the run //! failed to release. A bounded program grows by a slab or two; a leak -//! grows by the count. +//! grows by the count. A program that grows past the allowance runs a +//! third time, longer again: the growth a warm-up leaves stops by the +//! second run, and only a program that grows past the allowance again +//! leaks. //! //! `pressure/KNOWN_LEAKS` lists the programs known to grow, each with //! the git-bug issue that tracks why. A known leak that stops growing @@ -38,6 +41,8 @@ const LARGE: u64 = 400_000; /// makes has landed in both. const SMALL_LLVM: u64 = 100_000; const LARGE_LLVM: u64 = 1_000_000; +/// How many times the long run's steps the confirming run takes. +const CONFIRM_FACTOR: u64 = 4; /// Growth a bounded program is allowed between the two: the slabs its /// allocator takes, the code the long run compiles that the short one /// interprets, and the bodies kept for later tiers, all of which stop @@ -150,9 +155,29 @@ fn peak_memory_does_not_grow_with_the_step_count() { )); continue; } - let growth = large.saturating_sub(small); - let leaks = growth > ALLOWED_GROWTH; - let per_step = growth / (large_steps - small_steps); + let mut growth = large.saturating_sub(small); + let mut per_step = growth / (large_steps - small_steps); + let mut leaks = growth > ALLOWED_GROWTH; + if leaks { + let confirm_steps = large_steps * CONFIRM_FACTOR; + let (confirm_status, confirm) = run(program, confirm_steps); + if confirm_status != 0 { + failures.push(format!( + "{name}: exited {confirm_status} at {confirm_steps} steps" + )); + continue; + } + let further = confirm.saturating_sub(large); + eprintln!( + " {name}: {} MB to {} MB, then {} MB at {confirm_steps} steps", + small >> 20, + large >> 20, + confirm >> 20 + ); + leaks = further > ALLOWED_GROWTH; + growth = further; + per_step = further / (confirm_steps - large_steps); + } match (leaks, known.get(&name)) { (true, Some(issue)) => { known_count += 1; From 6bb5a3c7ebb968ef82177e5e4318ab3fc9c8184e Mon Sep 17 00:00:00 2001 From: darmie Date: Sun, 27 Sep 2026 14:59:25 +0000 Subject: [PATCH 2/2] Lua conformance: judge c_stack and finalize_after_return only where they are deterministic errors/c_stack.lua passes or fails on Windows depending on memory the runner can commit, and gc/finalize_after_return.lua depends on stack layout on macOS and Windows. Each now runs and must pass on the families where its answer is stable and is skipped elsewhere. git-bug: 4379825ab569b471e2c8f0c5e317cba2e0cfe506fa426a21795d52f76b3898eb git-bug: 18b4bab58c978c2adb03b1b309d4a8a8442d48673c30748f4dab02642669c873 --- crates/zyntax_lua/conformance/KNOWN_FAILURES | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/zyntax_lua/conformance/KNOWN_FAILURES b/crates/zyntax_lua/conformance/KNOWN_FAILURES index d71ee313..01b679bd 100644 --- a/crates/zyntax_lua/conformance/KNOWN_FAILURES +++ b/crates/zyntax_lua/conformance/KNOWN_FAILURES @@ -53,8 +53,8 @@ official_suite/complete_all 49075da official_suite/main_lua 49075da errors/library_names.lua 0903215 -errors/c_stack.lua 4379825 failing-on windows -gc/finalize_after_return.lua 18b4bab failing-on windows +errors/c_stack.lua 4379825 unix +gc/finalize_after_return.lua 18b4bab linux # C modules load where the executable exports the C API: not on Windows yet. official/attrib.lua c17ca09 unix