From: "eightbitraptor (Matthew Valentine-House)" Date: 2022-09-28T18:47:01+00:00 Subject: [ruby-core:110136] [Ruby master Bug#19029] Moving a transient heap allocated array between size pools can trigger GC while in GC Issue #19029 has been reported by eightbitraptor (Matthew Valentine-House). ---------------------------------------- Bug #19029: Moving a transient heap allocated array between size pools can trigger GC while in GC https://bugs.ruby-lang.org/issues/19029 * Author: eightbitraptor (Matthew Valentine-House) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- [Github PR 6466](https://github.com/ruby/ruby/pull/6466) RARRAY_PTR when called with a transient array detransients the array before returning its pointer which allocates in the heap. Because RARRAY_PTR was being used during compaction (when re-embedding arrays that have moved between size pools) this introduces the possibility that we can hit a malloc threshold, triggering GC, while in the middle of compaction. We should avoid this by using safer functions to get hold of the pointer. Since we know that the array is not embedded here, we can use ARY_HEAP_PTR and ARY_EMBED_PTR directly -- https://bugs.ruby-lang.org/ Unsubscribe: