Skip to content

Refine memory leak tests - #36

Merged
nobu merged 3 commits into
ruby:masterfrom
nobu:memory_leak-tests
Oct 19, 2026
Merged

nobu merged 3 commits into
ruby:masterfrom
nobu:memory_leak-tests

Conversation

@nobu

@nobu nobu commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

assert_no_memory_leak compared memory usage only before and after the test code ran. Temporary memory growth could cause intermittent failures, and a single comparison could not show whether growth continued or settled.

Take repeated memory samples and check the growth trend. A sample range allows the assertion to stop early when growth settles while limiting the maximum number of samples.

nobu added 3 commits October 19, 2026 14:03
Repeated sampling avoids false leak reports from transient RSS growth.
Allow memory leak assertions to stop sampling when memory growth
settles.  This helps avoid failures from transient memory use.
On macOS, it sometimes takes a little while for a process attached to
the debugger to be ready for `waitpid`.
@nobu
nobu merged commit fe302aa into ruby:master Oct 19, 2026
38 checks passed
@nobu
nobu deleted the memory_leak-tests branch October 19, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant