Skip to content

test: warm up right after GC.start in test_no_memory_leak - #217

Closed
kou wants to merge 2 commits into
ruby:masterfrom
kou:fix-test-no-memory-leak
Closed

kou wants to merge 2 commits into
ruby:masterfrom
kou:fix-test-no-memory-leak

Conversation

@kou

@kou kou commented Oct 12, 2026

Copy link
Copy Markdown
Member

test_no_memory_leak fails on ubuntu-latest 3.3 in CI:

<2441216> was expected to be less than
<2400000>.

This isn't a leak. The RSS grows only once, and it doesn't depend on the number of calls.

assert_nothing_leaked_memory runs the block right after GC.start. GC.start resets the malloc increase counters, so the next GC comes later and the block can raise the peak malloc usage. The process keeps that peak in RSS. The warm up loop doesn't run right after GC.start, so it doesn't reach the same peak.

Run GC.start before the warm up loop too. With this change, the RSS growth in the block is 0 in 10 of 10 runs locally. Without it, the growth is 1.4 MB to 1.5 MB in 6 of 10 runs.

kou and others added 2 commits October 12, 2026 22:44
`test_no_memory_leak` fails on `ubuntu-latest 3.3` in CI:

    <2441216> was expected to be less than
    <2400000>.

This isn't a leak. The RSS grows only once, and it doesn't depend on
the number of calls.

`assert_nothing_leaked_memory` runs the block right after `GC.start`.
`GC.start` resets the malloc increase counters, so the next GC comes
later and the block can raise the peak malloc usage. The process keeps
that peak in RSS. The warm up loop doesn't run right after `GC.start`,
so it doesn't reach the same peak.

Run `GC.start` before the warm up loop too. With this change, the RSS
growth in the block is 0 in 10 of 10 runs locally. Without it, the
growth is 1.4 MB to 1.5 MB in 6 of 10 runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Print RSS details from `/proc/self/status`, some `GC.stat` values and
`malloc_stats()` at each stage of `test_no_memory_leak`. The test
fails on CI with Ruby 3.1 but it doesn't fail locally.

This is temporary and will be removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kou
kou marked this pull request as draft October 12, 2026 21:23
@kou kou closed this Oct 12, 2026
@kou

kou commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

This doesn't fix the problem.

@kou
kou deleted the fix-test-no-memory-leak branch October 12, 2026 21:34
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