Huge burst of memory in c# service, what could be the cause?
- by Daniel
I'm working on a c# service application and i have this problem where out of no where and for no obvious reason, the memory for the process will climb from 150mb to almost 2gb in about 5 seconds and then back to 150mb. But nothing in our system should be using any where near that amount of memory (so its probably a bug somewhere). It might be a tight while true loop somewhere but the cpu usage at the time was very low so i thought i'd look for other ideas.
Now the weirder thing is when i compile the service for 64bit, the same massive burst will occur except it exceeded 10gb of ram (paging most of it) and it just caused lots of problems with the computer and everything running on it. After a while it shuts down but it looks like windows is still willing to give it more memory.
Would you have any ideas or tools that i can use in order to find this?
Yes it has lots of logging however nothing in the logs stand out as to why this is happening.
I can run the service in a console app mode, so my next test was going to be running it in visual studio debugger and see if i can find anything.
It only happens occasionally but usually about 10-20 minutes after startup.
On 32bit mode it cleans up and continues on like normally.
64bit mode it crashes after a while and uses stupid amounts of memory.
But i'm really stumped as to why this is happening!!!