When writing managed code, you don't need to worry about allocating or freeing memory: The garbage collector takes care of it. For efficiency reasons, some objects such as ``++Bitmap++`` use unmanaged memory, enabling for example the use of pointer arithmetic. Such objects have potentially huge unmanaged memory footprints, but will have tiny managed ones. Unfortunately, the garbage collector only sees the tiny managed footprint, and fails to reclaim the unmanaged memory (by calling ``++Bitmap++``'s finalizer method) in a timely fashion.
Moreover, memory is not the only system resource which needs to be managed in a timely fashion: The operating system can only handle having so many file descriptors (e.g. ``++FileStream++``) or sockets (e.g. ``++WebClient++``) open at any given time. Therefore, it is important to ``++Dispose++`` of them as soon as they are no longer needed, rather than relying on the garbage collector to call these objects' finalizers at some nondeterministic point in the future.
This rule tracks ``private`` fields and local variables of the following ``IDisposable`` / ``IAsyncDisposable`` types, which are never disposed, closed, aliased, returned, or passed to other methods.
``IDisposable`` / ``IAsyncDisposable`` variables returned from a method or passed to other methods are ignored, as are local ``IDisposable`` / ``IAsyncDisposable`` objects that are initialized with other ``IDisposable`` / ``IAsyncDisposable`` objects.