Explicit resource management
The using and await using declarations and the dispose and asyncDispose symbols manage the lifecycle of resources such as file handles and streams. The DisposableStack and AsyncDisposableStack objects can group, dispose, and coordinate dependencies between multiple disposable resources.
Status
Limited availability
MDN documentation
No MDN documentation found. You can search for the feature on MDN. If you believe that MDN has no documentation about this feature, you can open an issue on MDN's GitHub repository.Specifications
- ECMAScript Async Explicit Resource Management, from TC39 (Ecma International).
Browser support
- Chrome 134 Released on 2025-03-04
- Chrome Android 134 Released on 2025-03-04
- Edge 134 Released on 2025-03-06
- Firefox 141 Released on 2025-07-22
- Firefox for Android 141 Released on 2025-07-22
- Safari ❌
- Safari on iOS ❌
Baseline availability blocked since July 2025 by Safari (11 months)
Usage (according to Chrome Platform Status)
~0.229% of page loads. More data at chromestatus.com.Developer votes
Do you need this feature?
Let us know by leaving a 👍 reaction on the feedback issue. Don't forget to also leave a comment explaining your specific use case.
Developer use cases
-
Lots of resources on the web end up being stateful, from the DOM itself, to WebAudio components and WebGL components. It'd make managing them much more developer-friendly
Lots of resources on the web end up being stateful, from the DOM itself, to WebAudio components and WebGL components. It'd make managing them much more developer-friendly [see original comment] -
As part of development for the Satellite.js library, I'm creating a WebAssembly option to propagate orbits of satellites, instead of just pure JS one. For this I make use of unmanaged memory in C++. I expose the results of propagation as views into WASM memory. To use orbit propagation in WASM, user needs to instantiate a class; in its constructor the class allocates unmanaged memory to work with it on hot path later. This memory needs to be `free`d when the user is done. In the future major version of the library, as part of the WASM API, the objects that work with unmanaged memory will use Explicit Resource Management to clean up the unmanaged memory after themselves when they leave the scope, and users will be encouraged to declare such objects with `using`.
As part of development for the Satellite.js library, I'm creating a WebAssembly option to propagate orbits of satellites, instead of just pure JS one. For this I make use of unmanaged memory in C++. I expose the results of propagation as views into WASM memory. To use orbit propagation in WASM, user needs to instantiate a class; in its constructor the class allocates unmanaged memory to work with it on hot path later. This memory needs to be `free`d when the user is done. In the future major version of the library, as part of the WASM API, the objects that work with unmanaged memory will use Explicit Resource Management to clean up the unmanaged memory after themselves when they leave the scope, and users will be encouraged to declare such objects with `using`. [see original comment]
View as JSON | Edit this feature | Report an issue | Web-features entry: source, dist