I have a program, compiled using xlc_r, that spawns off multiple threads and am trying to trace it to see if there's any memory leaks. I've gone through this article detailing how I can use the MALLOCDEBUG feature that's built in to AIX, but after running format_mallocdebug_op.sh, it shows memory leaks all over the place for random pthread and file methods such as pthread_attri_init, _pth_init, fopen, fwrite, etc.
I then made a smaller test program that purposefully doesn't free a char * and compiled it with xlc_r and almost the exact same output appeared. I then compiled the test program again but with xlc and it worked correctly, showing the one char * memory leak and that was it. It seems that the MALLOCDEBUG feature doesn't work well with multi-threaded compiled applications. Is there a setting to tell it to be aware of this?
Asked
Active
Viewed 282 times
0

Zac
- 2,325
- 3
- 23
- 33
-
I see that you have been after this for a while: https://www.ibm.com/developerworks/community/forums/html/topic?id=60636ef7-5718-4918-a708-00c73d0fda29&ps=25 I've never been real happy with MALLOCDEBUG. You probably have done this but you can go here: http://www-01.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.base/kc_welcome_61.htm and search for MALLOCDEBUG. There are different versions of xlc. You might search their bug list. Or you can go to fix central http://www-933.ibm.com/support/fixcentral/ and search. If you have a few hundred, get an ISV contract and ask IBM directly. – pedz Aug 23 '14 at 02:45
-
Thanks, I have checked out the knowledgecenter but had no luck :(. I might just have to see if my company has a contract with IBM so I can call them. Thanks though! – Zac Sep 08 '14 at 16:38
-
I didn't think of this until just now... is your program exiting? If it is not and you are taking a snap shot of the running program, it might be that the support routines would free their allocations at exit time. Another thought: those might be real "leaks" in the sense that they are allocations but are never freed. e.g. they are some type of data structures that the multi-threaded libraries need. – pedz Sep 08 '14 at 20:34
-
That could be it actually. This program runs constantly and I usually just ctrl-c it when I'm done testing. I will try updating it to exit normally and see what the output is. Thanks! – Zac Sep 12 '14 at 21:02