Disposing generic lists
-
How do you dispose a generic list? Does
myList = null
solve the problem or does this only remove the reference to the instance and wait for the GC?In general, you should wait for the garbage collector to clear up resources.
Deja View - the feeling that you've seen this post before.
-
How do you dispose a generic list? Does
myList = null
solve the problem or does this only remove the reference to the instance and wait for the GC?Disposing only cleans up the unmanaged resources held by the object. The object itself can only be cleaned up by the GC.
-
How do you dispose a generic list? Does
myList = null
solve the problem or does this only remove the reference to the instance and wait for the GC?kensai wrote:
does this only remove the reference to the instance and wait for the GC
Yes, that is correct. If you are completely desperate to get the memory back however, it is possible to force the garbage collection afterwards (however I wouldn't reccomend it unless you are having *severe* problems without) Chris