473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 2565
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ianstirkcv | last post by:
Hello, I wonder if you can please help… We are running a web application built using .net framework version 1.0, service pack 2, running on Windows 2000 server, service pack 3. The server has...
11
by: jong | last post by:
I have a problem with an C# application. The application is a 24x7 low volume message processing server. The server has a single thread of processing, running in a continuous loop, for each...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
11
by: Pete Davis | last post by:
I have an app that's dealing with a few hundred bitmap thumbnails. I only instantiate the bitmaps that are visible at a given time and dispose of them if they get scrolled out of view. I've used...
1
by: Vladimir | last post by:
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...
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
1
by: booksnore | last post by:
I've been having a discussion with a collegue concerning how to identify memory leaks with applications running within the CLR. I read the microsoft article http://support.microsoft.com/kb/318263...
1
by: anushrestha | last post by:
I have a Windows Service written in C#. Memory used by the application based on the System.Environment.WorkingSet is 33MB at the begining. on average it goes up by 50MB every day. It reaches about...
22
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.