364,036 Members | 5023 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

memory leak using mtrace to find

subirs
P: n/a
subirs
Hi,

I am using mtrace to check for memory leaks in my code. The code is
divided into many fucntion which are placed in different directories.
While using mtrace the following output is given. Now the problem is
to find where in the code and in which function memory leaks occurs as
the trace does not give line number or name of the function.
------------------------------------------------------------------
Memory not freed:
-----------------
Address Size Caller
0x0804a400 0xa4 at 0x400a3bf4
0x0804a6c8 0x18 at 0x4005ec28
0x0804a710 0x18 at 0x4005e7b8
0x0804a768 0x18 at 0x4005e7b8
0x0804a788 0xc at 0x4005d8d1
0x0804a8b8 0x18 at 0x4005d783
0x0804a990 0x18 at 0x4005ec28
0x0804ab08 0x18 at 0x4005ec28
0x0804ab28 0x18 at 0x4005d783
0x0804ab58 0xc at 0x4005d8d1
0x0804ac48 0x18 at 0x4005d82a
0x0804ad48 0x18 at 0x4005d783
0x0804ad78 0xc at 0x4005d8d1
0x0804ad98 0xc at 0x4005d8d1
0x0804aeb8 0x18 at 0x4005d82a
0x0804aed8 0x24 at 0x4005c31d
0x0804b2d0 0x7c at 0x400592f8
0x0804b3f0 0xc at 0x4005d8d1
0x0804b400 0xc at 0x4005d8d1
0x0804b770 0x18 at 0x4005d783
0x0804b8b8 0x24 at 0x4005c31d
0x0804b8e0 0x18 at 0x4005d82a
0x0804b960 0x18 at 0x4005ec28
0x0804b9b0 0x18 at 0x4005e7b8
0x0804b9d0 0x18 at 0x4005e7b8
0x0804b9f0 0x18 at 0x4005d783
0x0804ba10 0xc at 0x4005d8d1
0x0804ba50 0xc at 0x4005d8d1
0x0804cb48 0x18 at 0x4005e7b8
0x0804d6d8 0x24 at 0x4005c31d
0x0804e6a0 0x18 at 0x4005e7b8
0x0804f150 0x1f0 at 0x4005928b
0x0804f348 0xa4 at 0x4005c75a
0x0804f3f0 0x1210 at 0x4005cb81
0x08050608 0x190 at 0x4005d6ca
0x08050aa0 0x450 at 0x4005e35e
0x08050ef8 0x18 at 0x4005e7b8
0x08051018 0x1210 at 0x4005cdde
0x08052330 0x1210 at 0x4005d0ab
0x08053948 0xa4 at 0x4005c75a
0x080539f0 0x1210 at 0x4005cb81
0x08054c08 0x190 at 0x4005d6ca
0x08054da0 0x18 at 0x4005d82a
0x08054fc0 0x18 at 0x4005d783
0x08054fe0 0x18 at 0x4005d82a
----------------------------------------------------------

Any help will be deeply appreciated,

thanks
subir

Apr 7 '06 #1
Share this Question
Share on Google+
3 Replies


Vladimir S. Oka
P: n/a
Vladimir S. Oka
subirs opined:
[color=blue]
> Hi,
>
> I am using mtrace to check for memory leaks in my code.[/color]

C knows not of `mtrace`...
[color=blue]
> The code is divided into many fucntion which are placed in different
> directories.[/color]

"Show me the money!"
[color=blue]
> While using mtrace the following output is given. Now the problem is
> to find where in the code and in which function memory leaks occurs
> as the trace does not give line number or name of the function.[/color]

"Show me the money!"

<snip meaningless gibberish>
[color=blue]
> Any help will be deeply appreciated,[/color]

If you really are after help, help us help you by providing the actual
code reduced to minimal compilable example that exhibits the problem,
and as much real information as possible.

If you can't be bothered, I'll venture a guess: your problem is on line
42, column 21, of the file zaphod.c, in the directory whatsit on the
Z: drive. Replace 74 with 82, and you're done!

--
"sic transit discus mundi"
(From the System Administrator's Guide, by Lars Wirzenius)

<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>

Apr 7 '06 #2

jacob navia
P: n/a
jacob navia
subirs wrote:[color=blue]
> Hi,
>
> I am using mtrace to check for memory leaks in my code. The code is
> divided into many fucntion which are placed in different directories.
> While using mtrace the following output is given. Now the problem is
> to find where in the code and in which function memory leaks occurs as
> the trace does not give line number or name of the function.
> ------------------------------------------------------------------
> Memory not freed:
> -----------------
> Address Size Caller
> 0x0804a400 0xa4 at 0x400a3bf4
> 0x0804a6c8 0x18 at 0x4005ec28
> 0x0804a710 0x18 at 0x4005e7b8
> 0x0804a768 0x18 at 0x4005e7b8
> 0x0804a788 0xc at 0x4005d8d1
> 0x0804a8b8 0x18 at 0x4005d783
> 0x0804a990 0x18 at 0x4005ec28
> 0x0804ab08 0x18 at 0x4005ec28
> 0x0804ab28 0x18 at 0x4005d783
> 0x0804ab58 0xc at 0x4005d8d1
> 0x0804ac48 0x18 at 0x4005d82a
> 0x0804ad48 0x18 at 0x4005d783
> 0x0804ad78 0xc at 0x4005d8d1
> 0x0804ad98 0xc at 0x4005d8d1
> 0x0804aeb8 0x18 at 0x4005d82a
> 0x0804aed8 0x24 at 0x4005c31d
> 0x0804b2d0 0x7c at 0x400592f8
> 0x0804b3f0 0xc at 0x4005d8d1
> 0x0804b400 0xc at 0x4005d8d1
> 0x0804b770 0x18 at 0x4005d783
> 0x0804b8b8 0x24 at 0x4005c31d
> 0x0804b8e0 0x18 at 0x4005d82a
> 0x0804b960 0x18 at 0x4005ec28
> 0x0804b9b0 0x18 at 0x4005e7b8
> 0x0804b9d0 0x18 at 0x4005e7b8
> 0x0804b9f0 0x18 at 0x4005d783
> 0x0804ba10 0xc at 0x4005d8d1
> 0x0804ba50 0xc at 0x4005d8d1
> 0x0804cb48 0x18 at 0x4005e7b8
> 0x0804d6d8 0x24 at 0x4005c31d
> 0x0804e6a0 0x18 at 0x4005e7b8
> 0x0804f150 0x1f0 at 0x4005928b
> 0x0804f348 0xa4 at 0x4005c75a
> 0x0804f3f0 0x1210 at 0x4005cb81
> 0x08050608 0x190 at 0x4005d6ca
> 0x08050aa0 0x450 at 0x4005e35e
> 0x08050ef8 0x18 at 0x4005e7b8
> 0x08051018 0x1210 at 0x4005cdde
> 0x08052330 0x1210 at 0x4005d0ab
> 0x08053948 0xa4 at 0x4005c75a
> 0x080539f0 0x1210 at 0x4005cb81
> 0x08054c08 0x190 at 0x4005d6ca
> 0x08054da0 0x18 at 0x4005d82a
> 0x08054fc0 0x18 at 0x4005d783
> 0x08054fe0 0x18 at 0x4005d82a
> ----------------------------------------------------------
>
> Any help will be deeply appreciated,
>
> thanks
> subir
>[/color]
This means (very probably) the following[color=blue]
> Address Size Caller
> 0x0804a400 0xa4 at 0x400a3bf4[/color]
The memory block at address 0x804a400 of size 164 bytes
allocated by the function at the address 0x400a3bf4 was
not freed.

Your problem is to find now what function is at address 400a3bf4.
You can find out by using some utility specific to the operating system
that gives you the address of the functions starting with an executable
image.
If you do not know of any utility like that load your program at the
debugger and see what function is at that address.

If nothing works you give me money and I will do it for you.

:-)

jacob
Apr 7 '06 #3

Al Balmer
P: n/a
Al Balmer
On Sun, 09 Apr 2006 23:00:07 +0200, jacob navia
<jacob@jacob.remcomp.fr> wrote:
[color=blue]
>subirs wrote:[/color]

Nothing relevant to the C language.

To the OP: please try to find an appropriate newsgroup. This is not
the one.

To Jacob: You should know better.

--
Al Balmer
Sun City, AZ
Apr 7 '06 #4

Post your reply

Help answer this question



Didn't find the answer to your C / C++ question?

You can also browse similar questions: C / C++