What are the best "automatic resource management" libraries

scala-arm does not seem updated anymore.

what are the best “automatic resource management” libraries?

Akka Streams deals with resources like storage (files) or network (TCP). Although it’s not the same as conventional try-with-resources constructs it automatically frees (AFAIK) resources when stream is completed (either successfully or because of an error).

https://doc.akka.io/docs/akka/2.5/stream/stream-io.html

Late to this party, but I’ve made a pretty similar lib to Scala ARM, and published for 2.12, 2.13, and 3.0: GitHub - dvgica/managerial: A zero-dependency Scala library for managing resources monadically. Largely based on the Twitter Util Managed code, with API inspiration from cats-effect Resource.

Not sure about “best”, but it’s working pretty well for me :-).

Just for the record, since 2.13, Scala standard library provides utility for resource management: Using. That is probably why scala-arm is no longer maintained

1 Like