Project

General

Profile

Actions

Feature #21957

open

Introduce `Enumerable#close` to free internal resources.

Feature #21957: Introduce `Enumerable#close` to free internal resources.

Added by ioquatix (Samuel Williams) 4 days ago. Updated 3 days ago.

Status:
Open
Target version:
-
[ruby-core:125071]

Description

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.

Actions

Also available in: PDF Atom