<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_gc.rb, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Backport #20157 to Ruby 3.3 (#9428)</title>
<updated>2024-02-01T04:33:30+00:00</updated>
<author>
<name>KJ Tsanaktsidis</name>
<email>ktsanaktsidis@zendesk.com</email>
</author>
<published>2024-02-01T04:33:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=920c17dc94239baae05b513046b27967f11a3569'/>
<id>920c17dc94239baae05b513046b27967f11a3569</id>
<content type='text'>
* Fix GC.measure_total_time regression

Commit 93ac7405b80cc61930d73da04441fa09af1851e1 introduced a regression
where measurements would still be taken after setting
GC.measure_total_time = false.

Fixes [Bug #20157]

* Add test case for GC.measure_total_time

---------

Co-authored-by: Rian McGuire &lt;rian@rian.id.au&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Fix GC.measure_total_time regression

Commit 93ac7405b80cc61930d73da04441fa09af1851e1 introduced a regression
where measurements would still be taken after setting
GC.measure_total_time = false.

Fixes [Bug #20157]

* Add test case for GC.measure_total_time

---------

Co-authored-by: Rian McGuire &lt;rian@rian.id.au&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>restore the stack pointer on finalizer</title>
<updated>2023-12-19T08:59:49+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2023-12-19T08:32:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f9a48548cf3ef54fc0a385ccd78c708737055ecc'/>
<id>f9a48548cf3ef54fc0a385ccd78c708737055ecc</id>
<content type='text'>
When error on finalizer, the exception will be ignored.
To restart the code, we need to restore the stack pointer.

fix [Bug #20042]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When error on finalizer, the exception will be ignored.
To restart the code, we need to restore the stack pointer.

fix [Bug #20042]
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix flaky test test_stat_heap</title>
<updated>2023-12-19T00:25:37+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-12-18T18:30:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ce436ff3e3cbd6810d7cf83fedbd2b55995ca0b1'/>
<id>ce436ff3e3cbd6810d7cf83fedbd2b55995ca0b1</id>
<content type='text'>
The test sometimes fails with:

    1) Failure:
    TestGc#test_stat_heap [/tmp/ruby/src/trunk-repeat50/test/ruby/test_gc.rb:169]:
    Expected 33434403 to be &lt;= 33434354.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The test sometimes fails with:

    1) Failure:
    TestGc#test_stat_heap [/tmp/ruby/src/trunk-repeat50/test/ruby/test_gc.rb:169]:
    Expected 33434403 to be &lt;= 33434354.
</pre>
</div>
</content>
</entry>
<entry>
<title>Skip a GC test for RJIT</title>
<updated>2023-12-13T07:24:19+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2023-12-13T07:24:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=20a09387d163b6d4ec77d1859f1cac480991ce9e'/>
<id>20a09387d163b6d4ec77d1859f1cac480991ce9e</id>
<content type='text'>
It randomly fails like this:
https://github.com/ruby/ruby/actions/runs/7191443542/job/19586164973
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It randomly fails like this:
https://github.com/ruby/ruby/actions/runs/7191443542/job/19586164973
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix SEGV caused by `GC::Profiler.raw_data` (#9122)</title>
<updated>2023-12-07T01:37:00+00:00</updated>
<author>
<name>Soutaro Matsumoto</name>
<email>matsumoto@soutaro.com</email>
</author>
<published>2023-12-07T01:37:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4f213ea1baa590c463c3554a6ff418d10dc291e0'/>
<id>4f213ea1baa590c463c3554a6ff418d10dc291e0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Loosen assertion for flaky weak references test</title>
<updated>2023-10-18T09:01:43+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-10-18T09:01:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f546fe15d547472f60c4a2d2857321b3c5084f0f'/>
<id>f546fe15d547472f60c4a2d2857321b3c5084f0f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix weak_references count test</title>
<updated>2023-09-08T16:45:00+00:00</updated>
<author>
<name>Matt Valentine-House</name>
<email>matt@eightbitraptor.com</email>
</author>
<published>2023-09-08T13:31:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7f53da94fb23687ef3bea0507199196a00ca26f8'/>
<id>7f53da94fb23687ef3bea0507199196a00ca26f8</id>
<content type='text'>
This test creates a lot of Objects held in an array, and a set of weak
references to them using WeakMap. It then clears the array and frees it
and asserts that all the weak references to it are also gone.

This test is failing because one of the dummy objects in our weakmap is
ending up on the stack, and so is being marked, even though we thought
that we'd removed the only reference to it.

This behaviour has changed since this commit:

https://github.com/ruby/ruby/commit/5b5ae3d9e064e17e2a7d8d21d739fcc62ae1075c

which rewrites `Integer#times` from C into Ruby. This change is somehow
causing the last object we append to our array to consistently end up on
the stack during GC.

This commit fixes the specific weakmap test by using an enumerator and
each, instead of `Integer#times`, and thus avoids having our last object
created end up on the stack.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This test creates a lot of Objects held in an array, and a set of weak
references to them using WeakMap. It then clears the array and frees it
and asserts that all the weak references to it are also gone.

This test is failing because one of the dummy objects in our weakmap is
ending up on the stack, and so is being marked, even though we thought
that we'd removed the only reference to it.

This behaviour has changed since this commit:

https://github.com/ruby/ruby/commit/5b5ae3d9e064e17e2a7d8d21d739fcc62ae1075c

which rewrites `Integer#times` from C into Ruby. This change is somehow
causing the last object we append to our array to consistently end up on
the stack during GC.

This commit fixes the specific weakmap test by using an enumerator and
each, instead of `Integer#times`, and thus avoids having our last object
created end up on the stack.
</pre>
</div>
</content>
</entry>
<entry>
<title>Correctly calculate initial pages</title>
<updated>2023-08-31T13:28:31+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-08-30T19:28:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4f0d58260a7f506ead198064d12a967edd11fe5e'/>
<id>4f0d58260a7f506ead198064d12a967edd11fe5e</id>
<content type='text'>
The old algorithm could calculate an undercount for the initial pages
due to two issues:

1. It did not take into account that some heap pages will have one less
   slot due to alignment. It assumed that every heap page would be able
   to be fully filled with slots. Pages that are unaligned with the slot
   size will lose one slot. The new algorithm assumes that every page
   will be unaligned.
2. It performed integer division, which truncates down. This means that
   the number of pages might not actually satisfy the number of slots.

This can cause the heap to grow in `gc_sweep_finish_size_pool` after
allocating all of the allocatable pages because the total number of
slots would be less than the initial configured number of slots.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The old algorithm could calculate an undercount for the initial pages
due to two issues:

1. It did not take into account that some heap pages will have one less
   slot due to alignment. It assumed that every heap page would be able
   to be fully filled with slots. Pages that are unaligned with the slot
   size will lose one slot. The new algorithm assumes that every page
   will be unaligned.
2. It performed integer division, which truncates down. This means that
   the number of pages might not actually satisfy the number of slots.

This can cause the heap to grow in `gc_sweep_finish_size_pool` after
allocating all of the allocatable pages because the total number of
slots would be less than the initial configured number of slots.
</pre>
</div>
</content>
</entry>
<entry>
<title>Change heap init environment variable names</title>
<updated>2023-08-30T23:37:11+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-08-30T20:49:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0aa404b9573d028d87072f40ecb9b86dc161b7ef'/>
<id>0aa404b9573d028d87072f40ecb9b86dc161b7ef</id>
<content type='text'>
This commit changes RUBY_GC_HEAP_INIT_SIZE_{40,80,160,320,640}_SLOTS to
RUBY_GC_HEAP_{0,1,2,3,4}_INIT_SLOTS. This is easier to use because the
user does not need to determine the slot sizes (which can vary between
32 and 64 bit systems). They now just use the heap names
(`GC.stat_heap.keys`).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit changes RUBY_GC_HEAP_INIT_SIZE_{40,80,160,320,640}_SLOTS to
RUBY_GC_HEAP_{0,1,2,3,4}_INIT_SLOTS. This is easier to use because the
user does not need to determine the slot sizes (which can vary between
32 and 64 bit systems). They now just use the heap names
(`GC.stat_heap.keys`).
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix growth in minor GC when we have initial slots</title>
<updated>2023-08-28T22:01:29+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-08-28T20:34:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fd0df1f8c6845671c86eddd85c9bcced30501690'/>
<id>fd0df1f8c6845671c86eddd85c9bcced30501690</id>
<content type='text'>
If initial slots is set, then during a minor GC, if we have allocatable
pages but the heap is mostly full, then we will set `grow_heap` to true
since `total_slots` does not count allocatable pages so it will be less
than `init_slots`. This can cause `allocatable_pages` to grow to much
higher than desired since it will appear that the heap is mostly full.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If initial slots is set, then during a minor GC, if we have allocatable
pages but the heap is mostly full, then we will set `grow_heap` to true
since `total_slots` does not count allocatable pages so it will be less
than `init_slots`. This can cause `allocatable_pages` to grow to much
higher than desired since it will appear that the heap is mostly full.
</pre>
</div>
</content>
</entry>
</feed>
