dlopen memory leak on mac os x.

 8 dyld dyld::loadPhase0(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
 
7 dyld dyld::loadPhase1(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
 
6 dyld dyld::loadPhase3(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
 
5 dyld dyld::loadPhase4(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
 
4 dyld dyld::loadPhase5(char const*, dyld::LoadContext const&, std::vector<char const*, std::allocator<char const*> >*)
 
3 dyld dyld::mkstringf(char const*, ...)
 
2 dyld strdup

loadPhase5 thow a exception, so may be a bug.

compile your target with gcc(apple) and -arch i386/x86_64

I compiled i386 target on ideneb but run it on x86_64 on snow leopard.
valgrin and instrument both assume there is memory leak.
after long debug I got an exception 
"mach-o, but wrong architecture" thrown by loadPhase5->loadPhase5Open()
(see also dyld.cpp in darwin's open source)


你可能感兴趣的:(dlopen memory leak on mac os x.)