Windows service question

Hi. I coded a Window Service using C# and I'm having a problem with it: it's using 30mb of memory which is too much for what it does. It's something like a task scheduler. The OnStart method runs a timer with one minute interval. The timer scans contents of a folder for txt files and parses them. The txt files have Sql commands, and are 4 lines. The Sql commands are very simple ones and the folder has only one txt file now. I did my best on the code and destroyed anything I could after using but this 30mb seems too much for such a simple service. I'd appreciate any ideas of what could be wrong on this one.
[653 byte] By [armagane] at [2007-12-16]
# 1
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!
papadi at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
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

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
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.
armagane at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified