Re: How 'reliable' is MallocCheckHeap et al ?
Re: How 'reliable' is MallocCheckHeap et al ?
- Subject: Re: How 'reliable' is MallocCheckHeap et al ?
- From: Eric Albert <email@hidden>
- Date: Sat, 25 Sep 2004 14:34:21 -0700
On Sep 24, 2004, at 8:36 PM, Andrew Kimpton wrote:
Eric Albert wrote:
On Sep 24, 2004, at 11:07 AM, Andrew Kimpton wrote:
I'm struggling to chase down what at first glance should be a
relatively simple memory smashing bug.
I'm using the MallocDebug environment variables :
Have you tried using Guard Malloc? It catches memory smashers very
effectively and pinpoints the exact place of the fault. (It also
causes your application to run about 100x slower than normal, but
that's worth it when you catch a memory smasher as a result.)
I have but I'm not sure how much it helps :-) I now get a
EXC_BAD_ACCESS from pthread_mutex_init(). My code uses boost_1_30_0
for it's shared_ptr classes and this particular pthread_mutex_init is
being called to initialize a member mutex within the boost
lightweight_mutex class. It *is* crashing from code called 'further
along' the call stack I gave previously, but it's still very puzzling
since the mutext structure passed in a class member for
lightweight_mutex which is (ultimately) a class member.
Breaking on pthread_mutex_init the pointer being given seems to point
to a 'short' block which is only 5 words (20 bytes) in length, The
pthread headers indicate that the pthread_mutex_t is 44 bytes long (a
long plus 40 char array). Previous calls (from the same constructor)
to pthread_mutex_init seem to be supplying a large enough block.
How do you know the size of the block?
This undersized allocation seems to be causing the problem but I'm not
sure how it can be occurring in this one spot. The pthread_mutex_t is
a class member and the pthread_mutex_init() is called in the class
constructor. This code path is very well exercised so why would it
fail here having been called hundreds (if not thousands) of times
without error previously ? The code in question is
boost_1_30_0/boost/detail/lwm_pthreads.hpp
Am I looking at some sort of strange compiler bug ?
Probably not...compiler bugs are exceedingly rare. I'm afraid I don't
know anything about boost, but if you can come up with a simplified
test case I'd be happy to take a look at it and see if I can figure
anything out.
One question from your earlier post, by the way: Are you running a
debug version of your code (compiled with -O0 and -g)? If not, try
that. It'll help you get better information from whichever tools you
use, though it also might cause the bug to disappear.
-Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden