471,350 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Memory Leak in C# Windows Service

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

--
- Vlad
Aug 19 '05 #1
1 2440
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.ReleaseComO bject

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

HTH
Brian Hman

"Vladimir" wrote:
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

--
- Vlad

Aug 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by ianstirkcv | last post: by
11 posts views Thread by jong | last post: by
17 posts views Thread by José Joye | last post: by
11 posts views Thread by Pete Davis | last post: by
1 post views Thread by Vladimir | last post: by
7 posts views Thread by Salvador | last post: by
1 post views Thread by booksnore | last post: by
22 posts views Thread by Peter | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.