dot.net application momory usage

G

Guest

The question is: I would like to know how to reduce my dot.net application
memory usage,
I have already tried to the SetProcessWorkingSetSize method with reduced the
memory in 7MB, but that’s not good enough.

many thanks in davance
 
W

W.G. Ryan MVP

Arie:

This isn't as straightforward as that per se. First off, how are you
measuring the memory usage? If you're using TaskManager, please be warned
that it's notoriously unreliable measure. Similarly, let's say that you
want to ensure that you only use 7 mb for instance, but you pull down a
dataset with x,000,0000 records in it that has a lot of columns. That is
going to occupy more memory (ok, it's possible that it wouldn't but assume
that the number is such that it would) than your limit so what do you want
to do then? Thrown an exception? Stop the application at that point?
You won't know exactly what point you're at that took you over the limit so
what would you do with the additional records?

Rather than looking for ex post facto mechanisms to limit this, at least at
the beginning I'd look to the code and determine what's causing the memory
to be eaten up in the first place. And in order to do this successfully,
you're going to have to do a lot to calculate different costs of objects and
methods and do even more to control what they can do.

As a general practice, it's a good idea to associate costs with methods and
properties - the CLR team for instance does that religously to guague
performance. You may want to google for Claudio Caldato (the performance
guru of the CLR team) and seek some suggestions from him as well since he
does this regularly, but beforehand I'd recommend getting a very clear idea
of what it is your end goal is and what you're willing to sacrifice to get
you there.

HTH,

Bill
 

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