Memory usage drift (again)

F

Fritz

.... maybe now that it's a little clearer.

Environment: Win Server 2003, :NET Framework 1.1, C#

I have an application that polls on a web service method every time a timer
event is raised. The method always returns an empty array of strings. I
report a part of the code just clarify a little:

public void OnTimedEvent(object source, ElapsedEventArgs e)
{
string s="UserName";
// jgpm is the web service reference
// getOrders() takes a string as input and
// returns an empty array of strings
string[] tickets=jgpm.getOrders(s);
}

Every time this code is executed, causes the memory usage to increase of
few KB. I have already tried forcing the call of GC by using
System.GC.Collect() but it didn't work.
Do you have any other suggestion?

Thanks in advance
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi
Do you have any other suggestion?

Just let the GC do its work :)

in case you have any worries decrease the interval of the timer and let it
running for a couple of days and see what happen, I'm pretty sure it will
not consume memory over a limit

Cheers,
 
W

Willy Denoyette [MVP]

As long as the memory increase is due to the managed heap growth, but what
if it's not the case.
The only way to know is to use a decent profiler, attach a debugger, or
carefully watch the performance counters.

Willy.
 
F

Fritz

The process starts from about 15MB and after few hours running reaches 150MB
and stops working. The call to the web service method starts generating
exceptions.
Monitoring the working set with performance monitor you can see a continuous
drift, sometime interrupted by the freed of a few MB.

Cheers
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Well, that is a complete different thing !!!
I think it's normal for the application to add a small amount of memory as
it works, I have a little win app that start with 8MB or so and it scale up
to 15 and no more, I also use a timer there so that's I thought you was
having a similar thing.

I suspect that a reference is being kept somewhere and this is preventing
the GC to collect the memory. There are several profilers that can help you
pinpoint the problem, take a look at the .net memory profiler (
www.scitech.se/memprofiler/ )

What is the exception that you are getting?

Cheers,
 
F

Fritz

Ok guys, thanks to all of you for your support untill now. Now I'm pretty
much an expert of memory management in Windows, I know by heart the GC
algorithm, I have installed and used a hundred analysis tools, but no
solution yet.
Now I know the problem clearly stands in a, more or less, atomic instruction

string[] tickets=jgpm.getOrders(s);

where "jgpm" is the reference to a web service and the code behind as been
completely auto-genereated by VSNet 2002. The parameter "s" is whatever
string identifying a customer, and the most of times the return value is an
empty array of strings.

I also know that the managed heap is stable and the drift is located inside
the native memory.

What else can I do?

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top