By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,222 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,222 IT Pros & Developers. It's quick & easy.

Windows service “Mem Usage” in the task manager.

P: n/a
Hi,
I have a windows service, which is currently installed, on my local computer.
The problem is that when I look at the task manager, I see that the “Mem
Usage”, become bigger and bigger.
Has someone any idea why this happens?
Anyway to solve this problem I thought to stop the service and start it
programmatically when it’s “Mem Usage” is too big.
Is it possible?

Jul 11 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I forgot to write that my windows service call a web service.

"Niron kag" wrote:
Hi,
I have a windows service, which is currently installed, on my local computer.
The problem is that when I look at the task manager, I see that the “Mem
Usage”, become bigger and bigger.
Has someone any idea why this happens?
Anyway to solve this problem I thought to stop the service and start it
programmatically when it’s “Mem Usage” is too big.
Is it possible?
Jul 11 '06 #2

P: n/a
"Niron kag" <Ni******@discussions.microsoft.comwrote in message
news:F9**********************************@microsof t.com...
Hi,
I have a windows service, which is currently installed, on my local
computer.
The problem is that when I look at the task manager, I see that the "Mem
Usage", become bigger and bigger.
Has someone any idea why this happens?
Anyway to solve this problem I thought to stop the service and start it
programmatically when it's "Mem Usage" is too big.
Is it possible?
You have a memory leak somewhere. Put a GC.Collect in a timer as a test to
make sure it's not just the garbage collector making the size larger. If
you've still got the memory leak then you need to track down where it is
coming from. If it's coming from your code, which is most likely, then you
just need to fix your code to eliminate the leak. Look for places where you
might leave objects alive. If it's from someone elses code then you'll have
more troubles but there's usually ways to solve that too.

Michael
Jul 11 '06 #3

P: n/a
Use performance counter to find the leak.

Process/Virtual Bytes
Process/Private Bytes
.net CLR Memory/# Bytes in all Heaps
.net CLR Memory/% Time in GC
.net CLR Memory/Large Object Heap size
.net CLR Loading/Bytes in Loader Heap
.net CLR Loading/Current Assemblies
if the private bytes keep increasing but # Bytes in all Heaps do not, you’re
likely looking at a native memory leak, but if # Bytes in all heaps increase
at the same rate as private bytes your leak is likely in managed code.

if you see a steady increase of virtual bytes but your private bytes stay
pretty steady, your application probably has a problem where it is reserving
a lot of virtual memory that it’s not using.

Bytes in Loader Heap and Current Assemblies should stay fairly constant once
the process has started up and all app domains are loaded. If this keeps
continuously increasing it is very probable that you have an assembly leak

"Niron kag" wrote:
Hi,
I have a windows service, which is currently installed, on my local computer.
The problem is that when I look at the task manager, I see that the “Mem
Usage”, become bigger and bigger.
Has someone any idea why this happens?
Anyway to solve this problem I thought to stop the service and start it
programmatically when it’s “Mem Usage” is too big.
Is it possible?
--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jul 11 '06 #4

P: n/a
You can consider using a memory profiler
If using a memory profiler - take the snapshot after the windows
service has completed atlest 1 or 2 iterations of what it is doing(
this way you take the initial snapshot once all the cache is
initialized), and then take a snapshot again once the service has
completed 1 or 2 more iterations.
Do a diff of the two snapshots( the memory profiler will give you tools
for that).
And you can see the objects which are growing in the memory and
possibly the methods which are creating them.

Pranshu

Jul 11 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.