title: Long running windows service with a memory leak? Or just looks like one?
body: <p>This sounds a little odd, but I'm not sure if my process has a memory leak or not, and I was hoping to get some information.  </p>
  
  <p>I was recently assigned an investigation into why a windows service in production was consuming roughly a gig of ram (the server it is running on has 8 gigs).  This is outside of my experience as a developer, but it's been a very good chance for me to read up on how garbage collection is working on msdn and other sources.  But at this point I'm very confused about /when/ collection actually runs, on this point, ever article I read is vague.</p>
  
  <p>1) I have found a specific operation that increases memory by ~30kb each time it is executed.
  2) I have very carefully gone over the code and believe that I am properly closing everything, and removing references
  3) I have used several memory profilers, all of them seem to indicate that my old objects are linked to the gc.
  4) If I leave the process absolutely idle for a few days, the memory usage suddenly plummets down to ~8 megs</p>
  
  <p>So based on this, I'm not even sure I have a memory leak.  Given that GC is an expensive process, is it possible that I grew to 1 gig in production just because there was still free ram to be had, and acquiring it was "cheaper" than running GC?  Especially given that this service is run ~6 times a second?  If this is the case, what options do I have?  I am of the understanding that I cannot forceably trigger GC, do I have any resort?</p>
  
  <p>Thank you for any input you might have, I realize memory leaks and gc in csharp is a deep topic and if there's a particularly helpful read on the subject, I'd be happy to be pointed that way as well.</p>