教你50招提升ASP.NET性能(十九):静态集合

(30)Static collections

招数30:

静态集合

If a collection is static, make sure it only contains the objects you need. If the collection is iterated over often, then the performance can be slow if you don’t remove unnecessary objects. Objects in a collection will be held in memory, even if they have been disposed of, which can also lead to a memory leak.
如果一个集合是静态的,确保它只包含你需要的对象。如果集合经常被遍历,如果你不移除不必要的对象,那么性能可能降低。集合中的对象将会占用内存,这也会导致内存泄漏,即时它们已经被处理过。

你可能感兴趣的:(asp.net)