Resource Management

Intro
Resource management refers to techniques for managing resources (components with limited availability). It includes both preventing resource leaks (releasing a resource when a process has finished using it) and dealing with resource contention (when multiple processes wish to access a limited resource).

Usages:
A key distinction in resource management within a program is between stack management and heap management – whether a resource can be handled like a stack variable (lifetime is restricted to a single stack frame, being acquired and released when execution enters and exits a particular scope), or whether a resource must be handled like a heap variable, such as a resource acquired within a function and then returned from it, which must then be released outside of the acquiring function. Stack management is a common use case, and is significantly easier to handle than heap management.