开发者

Debugging memory leaks with libMallocDebug

I want to use the MallocDebug app to find some memory leaks in my app. I'm running Mac OS X 10.6.2. Whenever I try and following the instructions listed in this guide, I get the following error:

dyld: could not load inserted library: /usr/lib/libMallocDebug.A.dylib

Trace/BPT trap

I have verified that the .dylib file exists, and I get the same error no matter 开发者_JAVA百科which app I try and run (it's not limited to my application). Several others have reported this problem as well, but so far no one has found a solution.

Any ideas?


libMallocDebug is not available for 64-bit executables.

% lipo -info /usr/lib/libMallocDebug.A.dylib    
Architectures in the fat file: /usr/lib/libMallocDebug.A.dylib are: i386 ppc7400 

It does appear to work with 32-bit executables in 10.6, though, for example:

% lipo -thin i386 /bin/ls -out foo
% DYLD_INSERT_LIBRARIES=/usr/lib/libMallocDebug.A.dylib ./foo        
libMallocDebug[foo-9141]: initializing libMallocDebug on thread 903
[...]

I'm not sure whether this is an oversight or it was never ported to the 64-bit runtime. You might try filing a bug.

Update: Seems there are just more debugging features in the regular malloc now. This discussion is pretty good.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜