title: C# Thread not releasing memory
body: <p>I have a windows service written in C#.Net. When the service is started, I spawn a new thread as shown below</p>
  
  <pre><code>new Thread(new ThreadStart(Function1)).Start();
  </code></pre>
  
  <p>This thread loops infinitely and performs the duties expected of my service. Once a day, I need to simultaneously perform a different operation for which my thread spawns a second thread as show below</p>
  
  <pre><code>new Thread(new ThreadStart(Function2)).Start(); 
  </code></pre>
  
  <p>This second thread performs a very simple function. It reads all the lines of a text file using FileReadAllLines , quickly processes this information and exits.</p>
  
  <p>My problem is that the memory used by the second thread which reads the file is not getting collected. I let my service run for 3 hours hoping that the GC would be called but nothing happened and task manager still shows that my service is using 150mb of memory. The function to read and process the text file is a very simple one and I am sure there are no hidden references to the string array containing the text. Could someone shed some light on why this is happening? Could it be possible that a thread spawned by another spawned thread cannot cleanup after itself?</p>
  
  <p>Thanks </p>