I programmed a Windows service to do the usual work.
I InstallUtil it to the windows service, and it wakes up and does something, and then thread.sleep(5min)
The code is simple, but I noticed a potential memory leak. I traced it using the DOS tasklist and drew a diagram: 
May I say that it is quite clear that there was a memory leak, although so few.
My code is similar to below, please help me find a potential leak. Thanks.
public partial class AutoReport : ServiceBase { int Time = Convert.ToInt32(AppSettings["Time"].ToString()); private Utilities.RequestHelper requestHelper = new RequestHelper(); public AutoReport() { InitializeComponent(); } protected override void OnStart(string[] args) { Thread thread = new Thread(new ParameterizedThreadStart(DoWork)); thread.Start(); } protected override void OnStop() { } public void DoWork(object data) { while (true) { string jsonOutStr = requestHelper.PostDataToUrl("{\"KeyString\":\"somestring\"}", "http://myurl.ashx"); Thread.Sleep(Time); } } }
Edit: after using WinDbg @Russell. What should I do with these classes?
MT Count TotalSize ClassName 79330b24 1529 123096 System.String 793042f4 471 41952 System.Object[] 79332b54 337 8088 System.Collections.ArrayList 79333594 211 70600 System.Byte[] 79331ca4 199 3980 System.RuntimeType 7a5e9ea4 159 2544 System.Collections.Specialized.NameObjectCollectionBase+NameObjectEntry 79333274 143 30888 System.Collections.Hashtable+bucket[] 79333178 142 7952 System.Collections.Hashtable 79331754 121 57208 System.Char[] 7a5d8120 100 4000 System.Net.LazyAsyncResult 00d522e4 95 5320 System.Configuration.FactoryRecord 00d54d60 76 3952 System.Configuration.ConfigurationProperty 7a5df92c 74 2664 System.Net.CoreResponseData 7a5d8060 74 5032 System.Net.WebHeaderCollection 79332d70 73 876 System.Int32 79330c60 73 1460 System.Text.StringBuilder 79332e4c 72 2016 System.Collections.ArrayList+ArrayListEnumeratorSimple 7.93E+09 69 1380 Microsoft.Win32.SafeHandles.SafeTokenHandle 7a5e0d0c 53 1060 System.Net.HeaderInfo 7a5e4444 53 2120 System.Net.TimerThread+TimerNode 79330740 52 624 System.Object 7a5df1d0 50 2000 System.Net.AuthenticationState 7a5e031c 50 5800 System.Net.ConnectStream 7aa46f78 49 588 System.Net.ConnectStreamContext 793180f4 48 960 System.IntPtr[]
source share