Issue #22383 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED to 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ruby_4_0 commit:4ac2a34ced6c37057d1d00b5ab90b0f12e902b58. ---------------------------------------- Bug #22383: Fix inverted `STR_SHARED` check in `rb_str_tmp_frozen_release` https://bugs.ruby-lang.org/issues/22383#change-119432 * Author: rwstauner (Randy Stauner) * Status: Closed * Backport: 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE ---------------------------------------- https://github.com/ruby/ruby/commit/45a2c95d0f7184c9cd64ddd26699af31bea8675d... mistakenly rewrote FL_TEST_RAW(orig, STR_SHARED) && !FL_TEST_RAW(orig, STR_TMPLOCK|RUBY_FL_FREEZE) as FL_TEST_RAW(orig, STR_SHARED | STR_TMPLOCK) == STR_TMPLOCK && !OBJ_FROZEN_RAW(orig) requiring orig to not be shared, the opposite of the original condition. orig always shares the buffer with tmp here, so the buffer was never given back and the string stayed shared until its next modification copied it. The next line of code then reads aux.shared from strings that are not shared, where the union holds aux.capa. -- https://bugs.ruby-lang.org/