Resource Allocation Is Initialization is a pattern that ties lifetime of an allocated object to allocated resources. Resources are allocated when an object is constructed and freed when the object is destroyed.
Many kinds of resources require a proxy in the application to represent accessibility and control. In an object oriented language that has explicit construction and destruction, you can control the lifetime of access to the resource by tying it to the object that acts as its proxy.
Here is a good summary of RAII that gives examples and provides some discussion.