Windows Service and memory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
I use a windows service with a system.timer
Every 10 secondes, it opens a oracle table with a datareader (with 0 or 10 lines) and execute POST HTTP queries

So, the service start with 10 Mo of memory used
After 65 HTTP posts (static function) it grows to 25 Mo.
And every day, it takes 1 Mo of memory

Here is the code inside finally block

finall

if (read != null

read.Close ()
read.Dispose ()

// relaunch the time
my_timer .Start ()


So, Is it normal
I do not think about memory leaks, i use Exception application block and data application block from MS..
and the code is very light .
How to manage memory of windows service ? Is there a way to recycle it like ASPNET_WP.exe
Thanks
JL
 
Well, it all depends on what types of data structures you are using for your
job. The best bet is to use CLR Profiler and see the heap snapshot. See if
there are any entries in the large object heap. You may not necessarily have
leaks but the objects may be unneccessarily getting promoted to higher
generations.
In case you feel memory reclamation is critical, consider calling
GC.Collect. Under most circumstances, this should not be necessary though.

I dont think you can restart the service from within the service. You can
use a buddy service/application that uses ServiceController class to restart
the other service at known intervals.

--
Manoj G [.NET MVP]
Site: http://www15.brinkster.com/manoj4dotnet
Blog: http://msmvps.com/manoj/

JLD said:
Hello,
I use a windows service with a system.timer.
Every 10 secondes, it opens a oracle table with a datareader (with 0 or 10
lines) and execute POST HTTP queries.
So, the service start with 10 Mo of memory used.
After 65 HTTP posts (static function) it grows to 25 Mo..
And every day, it takes 1 Mo of memory.

Here is the code inside finally block :

finally
{
if (read != null)
{
read.Close ();
read.Dispose ();
}
// relaunch the timer
my_timer .Start ();
}

So, Is it normal ?
I do not think about memory leaks, i use Exception application block and
data application block from MS...
 
Back
Top