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:

    I was like a social worker for lepers. My clients had a chunk of their body they wanted to give away; for a price I was there to receive it. Crimes, sins, nightmares, hunks of hair: it was surprising how many of them has something to dispose of. The more I charged, the easier it was for them to breathe freely once more.
    Tama Janowitz (b. 1957)

    Every child has an inner timetable for growth—a pattern unique to him. . . . Growth is not steady, forward, upward progression. It is instead a switchback trail; three steps forward, two back, one around the bushes, and a few simply standing, before another forward leap.
    Dorothy Corkville Briggs (20th century)