1753451 Members
5946 Online
108794 Solutions
New Discussion юеВ

Leaks in mainThread()

 
MJ_Techi
New Member

Leaks in mainThread()

Hi,

I am new to GDB(version 6.1). I would like to know about some errors like when I am finding memory leaks through gdb I am only getting the results like:-


20 bytes leaked in 1 blocks
No. Total bytes Blocks Address Function
0 20 1 0x4106c310 mainThread()

And :-

20 bytes leaked at 0x4106c310 (100.00% of all bytes leaked)
#0 0x200000007e8280d2 in mainThread() at ../cm_main.c:4258
#1 0x04000bc2 in main() at cm.cpp:22
#2 0x60000000c00427b2 in main_opd_entry() from /usr/lib/hpux32/dld.so


which I think cannot be possible or may be it is not finding the leaks at all and stuck at some point.

If anybody come across such issues please help me out.

thanks
MJ
3 REPLIES 3
Dennis Handly
Acclaimed Contributor

Re: Leaks in mainThread()

What is is doing on line 4258 of cm_main.c?

Do you ever free that space?
MJ_Techi
New Member

Re: Leaks in mainThread()

cm is an executable. we do not have the source code for cm_main.c.

But we have shared object(.so) files linked to cm.

These .so files contain custom API's


These API are invoked using custom workbenches(you can say dlopen)

We are able to successfully set the breakpoints within this API.

Sometimes the leaks are captured within this custom API's

But sometimes it goes to the cm_main.c and captures the above leaks(100% leak in mainThread()) and does not scan the API at all


Why is it so inconsistent?
Dennis Handly
Acclaimed Contributor

Re: Leaks in mainThread()

>But sometimes it goes to the cm_main.c and captures the above leaks (100% leak in mainThread()) and does not scan the API at all
Why is it so inconsistent?

I'm not sure how that can happen. The allocation site for memory should be very accurate. There should be a call to malloc at cm_main.c:4258. Perhaps sometimes this is freed by a call inside your API?