figuring Memory leaks

J

Jim

I got a program in C which takes unusual memory while running. Since I
have not written the program I dont have much idea abt the program
details. One way is obviously going thru the code and verifying.
Leaving this aside, I want to figure out why is this program chewing
so much of memory (sometimes 1 GB). I tried running on Rational Purify
but that simply exits. So can anyone suggest me some ways/ techniuqes
that one should follow for debugging these kind of problems. Do we
have any memory profiling tools that log the memory usage of the
program or a typical funtion. Thanks.. :~
 
M

Malcolm

Jim said:
Leaving this aside, I want to figure out why is this program chewing
so much of memory (sometimes 1 GB). I tried running on Rational Purify
but that simply exits. So can anyone suggest me some ways/ techniuqes
that one should follow for debugging these kind of problems. Do we
have any memory profiling tools that log the memory usage of the
program or a typical funtion. Thanks.. :~
There's no tool that works on all platforms, though there are plenty of leak
detectors on the market that will work with particular compilers.

If you can't find such a tool, there is no ideal way of finding out where
memory is leaking. You can try replacing malloc() with a home-grown function
that does logging (this is the technique we generally use). You can look
though the code - most allocations have a matching free in the same function
so can be discounted, leaving a few potential leaks.
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,951
Messages
2,570,113
Members
46,698
Latest member
alexxx

Latest Threads

Top