How to check memory leak in C/C++ programs?

I

iceColdFire

Hi,
I am writing some hybrid application s using C/C++ modules
together....Here I have created and used a lot of malloc(...) and
new(...) operators.

I am interested in checking on the optimisation part of the
programs...like memory consumed,memory leak , processor utilisation and
like...most of the info I got from task manager...however still I cand
find way to check on memory leaks...

Suggestions required on some good procedures or tools..

Thanks in advance,
a.a.cpp :)
 
D

Donovan Rebbechi

Hi,
I am writing some hybrid application s using C/C++ modules
together....Here I have created and used a lot of malloc(...) and
new(...) operators.

I am interested in checking on the optimisation part of the
programs...like memory consumed,memory leak , processor utilisation and
like...most of the info I got from task manager...however still I cand
find way to check on memory leaks...

Suggestions required on some good procedures or tools..

There are a number of leak checkers. A simple way to roll your own is to
overload operator new and that way you track allocations. Another way is
to get a leak checker. For example, there is a tool called ccmalloc that
tracks memory allocations and leaks. There are other more sophisticated
tools that also check for buffer overruns, etc.

For things like CPU usage, you probably should look for some sort of profiling
tool. These will track how much time different functions use, so you know
where you need to optimise.

Cheers,
 
A

Axter

iceColdFire said:
Hi,
I am writing some hybrid application s using C/C++ modules
together....Here I have created and used a lot of malloc(...) and
new(...) operators.

I am interested in checking on the optimisation part of the
programs...like memory consumed,memory leak , processor utilisation and
like...most of the info I got from task manager...however still I cand
find way to check on memory leaks...

Suggestions required on some good procedures or tools..

Thanks in advance,
a.a.cpp :)

Check out the following links:
http://code.axter.com/debugalloc.cpp
http://code.axter.com/debugalloc.h

http://code.axter.com/debuglogger.cpp
http://code.axter.com/debuglogger.h

http://code.axter.com/debuglog.c
http://code.axter.com/debuglog.h

The debugalloc.* code has the ability to track memory leaks, and it has
description and usage information in comments.

The debuglogger code has some code for profileing your code.

And the debuglog is some limited C version of the code.

It's mostly portable.

If you're programming using VC++, you should look up _CrtCheckMemory
and assoicated functions.
 
I

iceColdFire

:: Thanks Donovan, Axter, Rikrak

I am going through the links and other docs provided by you..

Shall ping this thread again if required...

Thanks again for good suggestions,
+ a.a.cpp :)
 
A

Achintya

Hi,

Some more good tools ...but *not* for free

Rational Purify -- for memory leaks
Rational Quantify -- for measuring performance
Rational PureCoverage -- for checking the test effectiveness.

-vs_p...
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top