Dispose pattern: Difference between revisions

Content deleted Content added
m Reverted 1 edit by 103.48.140.152 identified as test/vandalism using STiki
Minor typo fix
Line 32:
 
=== Prompt release ===
The fundamental problem that the dispose pattern aims to solve is that resources are expensive (for example, there may be a limit on the number of open files), and thus should be released promptly. Further, some finalization work is often needneeded, particularly for I/O, such as flushing buffers to ensure that all data is actually written.
 
If a resource is unlimited or effectively unlimited, and no explicit finalization is necessary, it is not important to release it, and in fact short-lived programs often do not explicitly release resources: due to short run time, they are unlikely to exhaust resources, and they rely on the [[runtime system]] or [[operating system]] to do any finalization.