Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have developed a windows service in c#.net which is basically a client server application. Here client sends request and server looks up in the local database using a third party API. A wrapper class is used to call the function of that API. My problem is, if i run that windows service send client request in a while loop for hours the memory in increasing but if i stop the client program memory is not decreasing at all(it remains on that level). Although I have done the same thing with a console application which seems to work fine as its memory are decreasing. Then i use memory profiler(perfmon, ants) but i cannot come up with a solution. I am really confused as my console application works fine ..but windows service is not(which is basically the same code except i have written the Main of my console application on ON_Start).

*It is a threaded server, for every client I creates one thread,

*I use tcpclient class.

*In the memory profiler private bytes are increasing, but # of .net heap bytes remains the same. but, I had called that wrapper class with another console program in a loop i didn't find any memory leak. confusing thing is console application working correctly.

* I override the dispose method of that wrapper class and latter call that dispose method whenever i used that object.
Posted
Updated 24-Sep-10 1:19am
v2
Comments
Henry Minute 24-Sep-10 9:16am    
Are you sure that the Dispose() is actually getting called and if so following the expected flow?

1 solution

I think your issues are involved in your Threading.. Most likely tied into the Disposal... check to see which objects are actually getting disposed of... It sounds like your dispose is being called oin the wrong object from a different thread...

Use the pattern

class myThreadWorkerClass :System.Threading.Thread
{
//blah..
}


I find this helps to keep me in the mindset that i am declaring memory on this perticular thread, and it also helps with cross thread problems...

hope that it is helpfull
(yes I know it has been a while since this thread was "active" :~)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900