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 virtues effect, not its substance.”
—Thomas Aquinas (c. 12251274)
“The kind of relatedness to the world may be noble or trivial, but even being related to the basest kind of pattern is immensely preferable to being alone.”
—Erich Fromm (19001980)