A suggestion, which will not solve the memory problem, would be to use System.IO.FileSystemWatcher to get notified about changes in a folder. This is why you have the timer, right?
As far as memory is concerned, is 30mb virtual & physical memory or just physical. Are there any other programs running? Operating system automatically moves programs from physical to virtual memory depending on their activity and the other programs that are running and their activity. Perhaps 30mb of physical memory in a machine with 512MB of physical RAM with no other programs running is not that big deal!
Hi,
Do not worry: If you are observing the "Mem Usage" column in task manager, all .NET applications have the runtime DLL size included in this figure. These are DLLs that are shared across all processes, so the actual hit in terms of RAM usage
occurs only on the first load.
You would need to use a tool such as Memory Profiler to get exact data:
http://www.scitech.se/memprofiler/
Regards,
Vikram
Thanks alot for the replies, I appreciate it. I actually managed to solve the problem. First of all, I forgot the service compiled in Debug mode. I changed it to Release and set optimise code parameter to true. Memory usage dropped to 20mb. Second, there was an error in the code. I had a code in a try catch block. It seems the code dropped to catch every 1 minute. I fixed the code and now the service uses only 10mb.