Methods and or Ideas on Reducing Memory Consumption

A

Anthony Nystrom

I am in real need to reduce memory consumption within one of my .net apps,
which is pretty large.... Any proven methods or ideas as to how to
accomplish this... Speeding garbage collection? disposing.... I am at a
loss... My code is clean with explicit object destruction after use and all
but the memory required continues to grow... Even on some machines that have
256 Mb Ram, they are getting Virtual Memory too low messages... It just
doesn't seem to be releasing resources fast enough..... any ideas or
thoughts or examples would be appreciated...

Thanks,

Anthony Nystrom
 
H

Herfried K. Wagner [MVP]

* "Anthony Nystrom said:
I am in real need to reduce memory consumption within one of my .net apps,
which is pretty large.... Any proven methods or ideas as to how to
accomplish this... Speeding garbage collection? disposing.... I am at a
loss... My code is clean with explicit object destruction after use and all
but the memory required continues to grow... Even on some machines that have
256 Mb Ram, they are getting Virtual Memory too low messages... It just
doesn't seem to be releasing resources fast enough..... any ideas or
thoughts or examples would be appreciated...

I would not care about that too much.

In some cases, a memory profiler can be useful:

Memory Profiler:

<http://www.gotdotnet.com/Community/...mpleGuid=3254325d-a4aa-4bb3-aa86-c72d5104ec74>
 
M

Mythran

Anthony Nystrom said:
I am in real need to reduce memory consumption within one of my .net apps,
which is pretty large.... Any proven methods or ideas as to how to
accomplish this... Speeding garbage collection? disposing.... I am at a
loss... My code is clean with explicit object destruction after use and all
but the memory required continues to grow... Even on some machines that have
256 Mb Ram, they are getting Virtual Memory too low messages... It just
doesn't seem to be releasing resources fast enough..... any ideas or
thoughts or examples would be appreciated...

Thanks,

Anthony Nystrom

Umm, what is your application doing? Would help to know a general idea of what's
going on in order to give a solution...but there are some general tips :)

Explicitly set all reference variables to Nothing (null in C#? Don't know if C#
supports it anymore). This will make sure when garbage collection runs by those,
they will be freed as soon as possible. If you are done with them, release them
asap and not when they run out of scope.

How large are the string you are dealing with? Are you dealing with very large
string concatenations?

Any datasets or other objects which contain massive amounts of data?

More info from you will mean more info to you.

Mythran
 
C

Cor

Hi Anthony,

Did you take specially care of unmanaged parts in your application and tried
to avoid them?

Cor
 

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