473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Windows service memory management

I've written a windows service (VB.NET 2003). When running, it consumes between 20-40 MB memory.

How do I optimize the memory usage?

I've set all objects to Nothing when I'm done using them.

What else can i do?

Regards,
Mikael
Jul 21 '05 #1
2 2423
Mikael,

Unless your memory usage keeps growing uncontrollably (i.e. after a few days
of having your service running it gets larger and larger), I wouldn't worry
about it.

..NET has a pretty complex memory management engine. On systems with a lot of
free memory, it may allocate more than it needs to keep performace up. Also,
when a .NET application is loaded, a lot of memory has to be allocated for
hosting the CLR. Even though task manager says it's using 40mb, not all of
this may be allocated, and some may still be available to other applicatons
to use if the system runs low on memory. Don't judge your total memory usage
on this figure.

Unless you're a pretty advanced user and want to get your hands dirty with
the operating system memory management features, don't worry about it.
I've set all objects to Nothing when I'm done using them.
Setting references to nothing does not de-allocate the memory used by
objects. They stay in the background until the Garbage collector comes along
and finalizes them. If you are using objects that implement the IDisposable
interface or have a "dispose" or "close" method on them, make sure you call
that before setting the object to nothing - this will ensure any unmanaged
resources (such as database connections or files) will be closed properly.

HTH,

Trev.
"Mikael Sorensen" <an*******@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com... I've written a windows service (VB.NET 2003). When running, it consumes between 20-40 MB memory.
How do I optimize the memory usage?

I've set all objects to Nothing when I'm done using them.

What else can i do?

Regards,
Mikael

Jul 21 '05 #2
Thanks Tre

I will monitor the service for about a week and see what happends

Regards
Mikael
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ger | last post by:
Hi, I have a problem with a Windows Service that I have created accessing System.Management.dll on a W2k3 environment. The Service runs fine on an XP machine but the same Service causes an error...
8
by: Greg Merideth | last post by:
I've written a basic windows service to provide some helper xml functions for my web methods and even thou the service is only about 1k lines long with 1 timer, its mem usage is 10m and its vm mem...
2
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be...
10
by: Ger | last post by:
I am having problems using VB.Net's Management base object on a machine hosting Windows Server 2003. I am trying to set file permissions from a Windows Service. These files may be loacted on a...
5
by: Brian Patrick | last post by:
I have an application model which will consist of a front-end configuration application, which needs to control the state of a back-end vb.net windows service (which is the component that does all...
2
by: Mikael Sorensen | last post by:
I've written a windows service (VB.NET 2003). When running, it consumes between 20-40 MB memory. How do I optimize the memory usage? I've set all objects to Nothing when I'm done using them. ...
2
by: Luc The Perverse | last post by:
I am a Java programmer - but I have had some experience programming in C++ before (3 years on a job) I have need of an application or set of applications to do the following on a windows...
2
by: Vadim Malishev | last post by:
Hello, Can anybody help to solve the following problem? My Windows Service trying to access remote machine to get WindowsDirectory Property over Win32_OperatingSystem WMI class. Both servers...
7
by: sachinkale123 | last post by:
I want to stop Sql server Agent Windows service. I am using below code to stop or start the windows service. Which is I am doing sucessfully. ManagedComputer mc = default(ManagedComputer); ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.