.net memory leakage

Is a memory leakage possible in .net? Yes. The unmanages resources should be freed by the application through Dispose. The other situation when a leakage can happen is when the events registered with some object and they are not freed through unregister. Third situation a memory leak can happen is when the collections are not freed before adding again as shown below. It is not necessary to call GC.Collect unless there is heavy usage of memory in an app and should be freed. When the GC.Collect is called, the GC goes through the finalizers of all the objects.

For i = 0 To 1000
      da.Fill(DS, "Table" + i.ToString)
Next

Leave a Reply

You must be logged in to post a comment.