Dispose Pattern

In computer programming, the dispose pattern is a design pattern which is used to handle resource cleanup in runtime environments that use automatic garbage collection. The fundamental problem that the dispose pattern aims to solve is that, because objects in a garbage-collected environment have finalizers rather than destructors, there is no guarantee that an object will be destroyed at any deterministic point in time. The dispose pattern works around this by giving an object a method (usually called Dispose or similar) which frees any resources the object is holding onto.

Many garbage-collected languages offer language constructs to avoid having to call the dispose method explicitly in many situations. These language constructs leads to results similar to what is obtained with the Resource Acquisition Is Initialization (RAII) idiom in languages with deterministic memory management (like e.g. C++).

Read more about Dispose Pattern:  Motivation, Language Constructs

Famous quotes containing the words dispose and/or pattern:

    Virtues are not emotions. Emotions are movements of appetite, virtues dispositions of appetite towards movement. Moreover emotions can be good or bad, reasonable or unreasonable; whereas virtues dispose us only to good. Emotions arise in the appetite and are brought into conformity with reason; virtues are effects of reason achieving themselves in reasonable movements of the appetites. Balanced emotions are virtue’s effect, not its substance.
    Thomas Aquinas (c. 1225–1274)

    His talent was as natural as the pattern that was made by the dust on a butterfly’s wings. At one time he understood it no more than the butterfly did and he did not know when it was brushed or marred. Later he became conscious of his damaged wings and of their construction and he learned to think and could not fly any more because the love of flight was gone and he could only remember when it had been effortless.
    Ernest Hemingway (1899–1961)