From: "ioquatix (Samuel Williams) via ruby-core" Date: 2026-07-02T06:19:56+00:00 Subject: [ruby-core:125912] [Ruby Feature#21957] Introduce `Enumerable#close` to free internal resources. Issue #21957 has been updated by ioquatix (Samuel Williams). @mame If we decide to use `Fiber#kill` for terminating the fiber (which seems reasonable), it seems bad that it may not return to the point that `rb_fiber_kill` was invoked. WDYT? ---------------------------------------- Feature #21957: Introduce `Enumerable#close` to free internal resources. https://bugs.ruby-lang.org/issues/21957#change-117847 * Author: ioquatix (Samuel Williams) * Status: Open * Assignee: ioquatix (Samuel Williams) ---------------------------------------- In some cases, `Enumerable` has substantial internal state (e.g. Fiber) related to enumeration. There is currently no way to clear up this state besides garbage collection, which means that we can accumulate considerable garbage before cleaning up, even if we know when the enumerable is no longer needed. I'd like to introduce `Enumerable#close` which invalidates the enumerable, freeing internal resources. After which, most usage would result in `Enumerable::ClosedError`. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/