Running Service Memory Increasing...

Hi all,

I have created a service that polls a usb device every ~10secs and stores data to a small-ish database (around 10k or 15k records) with every poll. Seems to be running OK, but the Windows Task Manager > Processes tab shows that it is using continuously more and more memory. As I write this, Mem Usage is at 24,516 k and slowly growing. This seems strange to me as it is not a very complex service, does this look like a GC problem

I'm very new to coding with database manipulation methods, so I set up a simple access database and have been using table adapters to do all my data transactions. It seems to me there may be an inherent problem in the way I'm doing this, as I have to use the tableadapter.Fill(datatable) method each time I want to access stuff inside the database tables. This method fills a local datatable with the entire database table I select, and as that grows the local variable grows. Does that sound like an avoidable problem to anyone If so, how can I access this database and look at entire tables without storing everything to a local object first

Thanks for any help :-)



Answer this question

Running Service Memory Increasing...

  • Pablo A Castillo

    Why you need to read all table when all you do is inserting data on every 10 seconds. Instead of DataAdapter use OleDbCommand to only insert a new row in Access Table. DataAdapter is used when you have a table on which you make changes like inserts updates, deletes, and you want simpler method of updating table. Even if you do all this operations, do changes with commands and not adapter.
    Problem with memory is probably because your table that you are holding all time, is growing.
    There is no problem with GC. GC know when to remove unused references and memory space, so you don't have to wory about that.

  • CManoj

    Well I followed the previous advice and went from using tableadapters to using OLEDBCommands but the memory is still slowly increasing. Anyone else have any experience with plugging leaks I'm not sure how to approach this.

    Thanks for any help :-)


  • Chris Spain

    Just as a followup, I'll note that the leak was in a .NET library (not MS) I was using. Thanks for the suggestions :-)
  • coolblue2000

    Thank you, I'll give that a try. That is what I suspected the problem was.


  • Running Service Memory Increasing...