J
Jack Fox
I suspect, but can't prove a memory leak in my application.
My first suspicion was that I am using some objects that implement IDispose
and I wasn't calling the Dispose method, but I can't find any. The app uses
a lot of ArrayLists, SortedLists, Arrays, and StringBuilders.
The only other thing I can think of is that one of my working assumptions
about C# is incorrect:
1) If I declare an ArrayList, SortedList, Array, or StringBuilder locally in
a static or non-static method I DO NOT need to set them to null before the
method completes. As soon as the method is out of scope, they become
eligible for garbage collection.
2) If I declare ArrayLists, SortedLists, Arrays, or StringBuilders within my
own class, once an object derived from that class has no more references, it
and all of the objects within it are eligible for garbage collection without
setting any objects within the class to null. I do not need to implement the
IDispose interface for these classes, because there is nothing to Dispose
within them.
It is natrual for this app to grow. I may not have a leak at all. It may be
that I just do not understand why it grows so large.
My first suspicion was that I am using some objects that implement IDispose
and I wasn't calling the Dispose method, but I can't find any. The app uses
a lot of ArrayLists, SortedLists, Arrays, and StringBuilders.
The only other thing I can think of is that one of my working assumptions
about C# is incorrect:
1) If I declare an ArrayList, SortedList, Array, or StringBuilder locally in
a static or non-static method I DO NOT need to set them to null before the
method completes. As soon as the method is out of scope, they become
eligible for garbage collection.
2) If I declare ArrayLists, SortedLists, Arrays, or StringBuilders within my
own class, once an object derived from that class has no more references, it
and all of the objects within it are eligible for garbage collection without
setting any objects within the class to null. I do not need to implement the
IDispose interface for these classes, because there is nothing to Dispose
within them.
It is natrual for this app to grow. I may not have a leak at all. It may be
that I just do not understand why it grows so large.