8.4 Automatic memory management
2005-11-28 22:15
393 查看
8.4 Automatic memory management
Manual memory management requires developers to manage the allocation and
de-allocation of blocks of
memory. Manual memory management can be both time-consuming and difficult.
In C#, automatic memory
management is provided so that developers are freed from this burdensome
task. In the vast majority of
cases, automatic memory management increases code quality and enhances
developer productivity without
negatively impacting either expressiveness or performance.
The example
using System;
public class Stack
{
private Node first = null;
public bool Empty {
get {
return (first == null);
}
}
public object Pop() {
if (first == null)
throw new Exception("Can’t Pop from an empty Stack.");
else {
object temp = first.Value;
first = first.Next;
return temp;
}
}
Manual memory management requires developers to manage the allocation and
de-allocation of blocks of
memory. Manual memory management can be both time-consuming and difficult.
In C#, automatic memory
management is provided so that developers are freed from this burdensome
task. In the vast majority of
cases, automatic memory management increases code quality and enhances
developer productivity without
negatively impacting either expressiveness or performance.
The example
using System;
public class Stack
{
private Node first = null;
public bool Empty {
get {
return (first == null);
}
}
public object Pop() {
if (first == null)
throw new Exception("Can’t Pop from an empty Stack.");
else {
object temp = first.Value;
first = first.Next;
return temp;
}
}
相关文章推荐
- 8.4 Automatic memory management(cont')
- Oracle 11g internals part 1: Automatic Memory Management
- Garbage Collection : Automatic Memory Management in the Microsoft .NET Framework 垃圾回收:在微软NET框架自动内存管理(一)
- compiler之automatic memory management以及Java GC
- Oracle 11g internals part 1: Automatic Memory Management
- QUESTION 56 Automatic Shared Memory Management is disabled for your database instance. You realize t
- 10.9 Automatic memory management
- 39 Which statement about Automatic Memory Management with Oracle 11g is true?
- 57.Automatic Shared Memory Management is disabled for your database instance. You realize that there
- Automatic Tuning of Memory Management
- Oracle 11g Automatic Memory Management
- 理解自动内存管理(Automatic Memory Management)
- Using Automatic Memory Management
- Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework
- C#自动化的内存管理(Automatic memory management)
- 133 You want to enable automatic PGA memory management in your database. Which setting is required t
- Garbage Collection Part 2: Automatic Memory Management in the Microsoft .NET Framework垃圾回收:在微软NET框架自动内存管理 (二)
- C#自动化的内存管理(Automatic memory management)
- Automatic Memory Management(AMM)…
- Oracle 11g internals part 1: Automatic Memory Management