I'm developing a Desktop Search Engine in VB9 (VS2008).
Is it normal for a Service to take up 9MB of Memory while the only Thread involved in the Service is sleeping?
The code includes following import statements...
Imports System
Imports System.IO
Imports Microsoft.Win32
Imports System.Threading
There are a few class variables in the Service class
Private serviceStarted As Boolean = False
Dim workerThread As Thread
Dim DSEKey As RegistryKey
Dim indexFolder As String
Dim tempFolder As String
Dim docFolders As String()
Dim interval As Integer
The OnStart method takes the following form:
protected override void OnStart(string[] args)
{
ThreadStart st = new ThreadStart(WorkerFunction);
workerThread = new Thread(st);
serviceStarted = true;
workerThread.Start();
}
The WorkerFunction takes the following form:
private void WorkerFunction()
{
while (serviceStarted)
{
// Desired function - STARTS
// Desired function - ENDS
// Close all open objects
if (serviceStarted)
{
Thread.Sleep(new TimeSpan(0, interval, 0);
}
}
Thread.CurrentThread.Abort();
}
Process Explorer describes Physical memory usage as:
Working Set: 9,440 K
WS Private: 2,356 K
WS Shareable: 7,084 K
WS Shared: 6,440 K
Is this normal or am I doing something wrong?