...
- It is also imprudent to use finalizers for reclaiming scarce resources by enforcing garbage collection. Garbage collection usually depends on memory related traits and not on the scarcity of a particular resource. As a result, if memory is readily available, a scarce resource may get exhausted even in the presence of a finalizer. See FIO06-J. Ensure all resources are properly closed when they are no longer needed and CON21-J. Use thread pools to enable graceful degradation of services service during traffic bursts for more details on handling resources correctly.
...