Memory Leak in C# Windows Service

V

Vladimir

I created a windows service that performs a MSSQL2000 database analysis in a
separate threads with a specified interval. And when running this service
uses a lot of system memeory and it does release it after finishing it's
jobs and starting to "sleep". I use there Microsoft.AplicationBlocks.Data
libary to access database and I suppose the service caches the data since it
performs all the next parcings at a moment unlike at the first time for 20
minutes. Actually the service is working fine except memory leak, I have put
null to every object, and made sure that Microsoft.AplicationBlocks.Data
libary closes db connections.

Does anybody know how can I make my service to release memory when it is
finished it's job and how can I manage the ADO.NET caching?

Thanks
 
G

Guest

Vladimir,

With your database connections and datareaders you want to make sure
that they are being "closed" when you're done with them. So if you create
a rdr with the application block you need to make sure that you call
rdr.close().

Also if you happen to use any COM objects in your code you need to use
System.Runtime.InteropServices.Marshal.ReleaseComObject

to release the COM object rather than just setting it to null.

HTH
Brian Hman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top