Dispose pattern: Difference between revisions

Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Libnoon (talk | contribs)
Resource management is always manual: not specific to the Dispose pattern.
Line 3:
In [[object-oriented programming]], the '''dispose pattern''' is a [[design pattern (computer science)|design pattern]] for [[resource management (computing)|resource management]]. In this pattern, a [[system resource|resource]] is held by an [[object (computing)|object]], and released by calling a [[method (computer science)|method]] – usually called <code>close</code>, <code>dispose</code>, <code>free</code>, <code>release</code>, or similar – which releases any resources the object is holding onto. Many languages offer language constructs to avoid having to call the dispose method explicitly in common situations.
 
The dispose pattern is primarily used in languages whose [[runtime environment]] have [[automatic garbage collection]] (see motivation below), and thus may be styled as ''manual'' resource management in languages with [[automatic memory management|''automatic'' memory management]].
 
== Motivation ==