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)

    The real trouble about women is that they must always go on trying to adapt themselves to men’s theories of women, as they always have done. When a woman is thoroughly herself, she is being what her type of man wants her to be. When a woman is hysterical it’s because she doesn’t quite know what to be, which pattern to follow, which man’s picture of woman to live up to.
    —D.H. (David Herbert)