Content deleted Content added
Not releasing a resource is not necessarily a deliberate act; in fact, in most cases it is only a mistake by omission. |
→Stack management and heap management: Talking about stack and heap is too specific (think about Python's "with" statement); this concept is more general and applies to lexical scope versus explicit releasing of the resource |
||
Line 30:
Memory can be treated as a resource, but [[memory management]] is usually considered separately, primarily because memory allocation and deallocation is significantly more frequent than acquisition and release of other resources, such as file handles. Memory managed by an ''external'' system has similarities to both (internal) memory management (since it is memory) and resource management (since it is managed by an external system). Examples include memory managed via native code and used from Java (via [[Java Native Interface]]); and objects in the [[Document Object Model]] (DOM), used from [[JavaScript]]. In both these cases, the [[Memory management|memory manager]] ([[Garbage collection (computer science)|garbage collector]]) of the [[runtime environment]] (virtual machine) is unable to manage the external memory (there is no shared memory management), and thus the external memory is treated as a resource, and managed analogously. However, cycles between systems (JavaScript referring to the DOM, referring back to JavaScript) can make management difficult or impossible.
==
A key distinction in resource management within a program is between ''
==Basic techniques==
|