diff options
author | Peter Zhu <peter@peterzhu.ca> | 2021-06-10 09:59:12 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2021-06-10 10:59:32 -0400 |
commit | 929cc615a749f467809a865a3d40adcc0b58c667 (patch) | |
tree | e7cbd40826e8503452e964a27bfb1e0b9a397349 /version.h | |
parent | d281fc525dbf81b7b3eeda5d529c921a89902127 (diff) |
Finish GC before calling gc_set_initial_pages
If we are during incremental sweeping when calling gc_set_initial_pages
there is an assertion error. The following patch will artificially
produce the bug:
```
diff --git a/gc.c b/gc.c
index c3157dbe2c..d7282cf8f0 100644
--- a/gc.c
+++ b/gc.c
@@ -404,7 +404,7 @@ int ruby_rgengc_debug;
* 5: show all references
*/
#ifndef RGENGC_CHECK_MODE
-#define RGENGC_CHECK_MODE 0
+#define RGENGC_CHECK_MODE 1
#endif
// Note: using RUBY_ASSERT_WHEN() extend a macro in expr (info by nobu).
@@ -10821,6 +10821,10 @@ gc_set_initial_pages(void)
void
ruby_gc_set_params(void)
{
+ for (int i = 0; i < 10000; i++) {
+ rb_ary_new();
+ }
+
/* RUBY_GC_HEAP_FREE_SLOTS */
if (get_envparam_size("RUBY_GC_HEAP_FREE_SLOTS", &gc_params.heap_free_slots, 0)) {
/* ok */
```
The crash looks like:
```
Assertion Failed: ../gc.c:2038:heap_add_page:!(heap == heap_eden && heap->sweeping_page)
```
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4562
Diffstat (limited to 'version.h')
0 files changed, 0 insertions, 0 deletions