dmalloc doesn't show log when a program compiled with pthread

来源:互联网 发布:sql between 编辑:程序博客网 时间:2024/06/06 12:57
Recently I have tried to implement a program to manage my system services. In fact, this is a server-side program, I want it to be a multiple thread program to process multiple requests from client. This program has too many malloc/calloc and free, so I used dmalloc to  help to find the unfreed memory. The latest dmalloc version is 5.5.2. Both my Ubuntu and Embedded System use dmalloc-5.5.2. But a weired scenario happens in my Embedded System. It has no log printed. Why the same version dmalloc has different result? Then I compared the dmalloc.h between Ubuntu 13.04 with my Embedded System. They are different, so I think the dmalloc in Ubuntu should have been fixed with a patch. But I don't know where to get the patch? Then I tried to read the pdf file "dmalloc.pdf", which you can find in dmalloc package. Finally, I find a solution from the document. I invokedmalloc_shutdown() in my program before it exit. Then the log file shows.Note, this scenario only happens when compiled with -lpthread, even if you don't use it actually!
原创粉丝点击