memory leaks

G

Guest

Some time ago I was looking for a cheap or free way to check an application
written in C# and some unsafe code for memory leaks. Someone in this forum
suggested DevPartner form Compuware, telling me that there is a free basic
version out there. However I can’t find it. Nowhere on the Compuware website
is a link to anything under $4000. Am I just missing something? Are there
other ways to check for memory leaks than 3rd party products?
 
G

Guest

The easiest way I know of to check for memory leaks is:
step 1. open Task Manager.
step 2. write down Available Memory from the Performance tab.
step 3. open Your App.
step 4. write down Available Memory from the Performance tab.
step 5. close Your App.
step 6. repeate steps 2 thru 5 several times.

Results: if Available Memory keeps reducing, you have a memory leak.

step 7. between steps 3 & 4, use your App so that all the modules and
objects in your app get used.

Results: if Available Memory keeps reducing, you have a memory leak.

This is not a full-proof way of checking. But is a start in the right
direction, for free.
 
C

Cor Ligthert [MVP]

Cnickl,

Why would you do it .Net is created to prevent memoryleaks.

If you have them than look at those 3 threads where Willy was active. If you
don't find it, than you can search in it using everytime that Willy. He has
written it here the most in dept.

One thing you should not do, is pay attention to the taskmanger, that is a
kind of fuel indicator how many kilometers/miles you can still go, but
certainly not accurate.

I hope this helps,

Cor
 
G

Guest

Thanks to both of you. My reason for check for memory leaks is that I’m using
some unsafe (unmanaged) code missed with .NET.
 
G

Guest

Cor,
If you followed my steps exactly, it would show modules not unloading and
resources not being released. Resources and memory would then be reallocated
for each new instance of the program loaded into memory. Eventually you'll
have no memory to load the program into if you're program is not releasing
everything upon exit. I fully understand Windows caching and that's why I
said several times. I defy anyone to show how using my procedures exactly
that you wouldn't have a memory leak with constantly reducing memory and
resources.
Now, it is still possible to have a memory leak and not have the memory
being reduced under task manager. I didn't say my way was 100% accurate. But
that it was free and would spot the worse offenders.

FYI, there are two very popular games and a major software product that fail
the test that I showed. The solution all three manufacturers suggest is to
reboot the system. Even though they don't admit it, sounds like a memory leak
to me.

And another note: You could always do a memory dump. But this is very hard
and is why programs are written costing 4k, or more, to do. But if you know
how to do this, it is the most accurate. In my former life, I don't know how
many thousands of pages of memory dumps that I manually sifted through to
write assembly programs that would do exactly what I wanted them to do.


Thanks.
 
G

Guest

Hi again,
If your using code for ISO900x, stop. Unless you're part of the developement
team or document control team, you could be risking your company's rating.
Uncontrolled or unmanaged code in those envirnoments may not work as intended
and are works in progress at best.
Thanks.
 

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