• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How 'reliable' is MallocCheckHeap et al ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How 'reliable' is MallocCheckHeap et al ?


  • Subject: How 'reliable' is MallocCheckHeap et al ?
  • From: Andrew Kimpton <email@hidden>
  • Date: Fri, 24 Sep 2004 11:07:53 -0700

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 :

MallocScribble 1
MallocGuardEdges 1
MallocStackLogging 1

I've set MallocCheckHeapStart to fairly high number (but still approx 25000 - yep 3 zeros) before where my crash occurs. I've set MallocCheckHeapEach to 1

when my crash occurs gdb says :

invariant broken for tiny block <addr> this msize=0 - size is too small
Tiny region 0 incorrect szone_check_all() counter=2229
error : Check: tiny region incorrect

The backtrace at this point gives me top of the stack where top lines (of my code) is :

<blah>/ZCreator.h:34
<blah>/ZClassRegistry.cpp:315
<blah>/ZView.cpp:1599

using atos with the 'last malloc check succeeded' details gives me a stack trace where the top lines of my code are :

<blah>/ZClassRegistry.cpp:315
<blah>/ZView.cpp:1599


since the line at ZClassRegistry.cpp:315 is :

return creator->CreateObject(xml);

And ZCreator.h:34 is

32: ZObject::ptr ZCreator::CreateObject(...)
33: {
34: return ZObject::ptr(new Tobject(xml, blah));
35: }

I don't quite understand how I can have an allocation at line 315 (the xml variable is on the stack - and it's copy constructor doesn't allocate), furthermore even if there is an allocation at line ZClassRegistry.cpp:315 why would it fail on the next line of code to be executed when there have been no heap manipulations in between.

I'm clearly missing something. One thing I'm missing is how to set up a hardware watchpoint on the heap area being 'touched' so that I can pin the blame on something. watch <addr> returns with a new watchpoint but the app seems to run so slowly that I think it's deadlocked and awatch <addr> gives an error about being unable to set the watchpoint.

Any thoughts or further directions or tools I can use ? Also can some one point me to a document (or source from Darwin) that describes how the heap is layed out, management structures etc. etc. sources for szone_check_all() perhaps ?

Many thanks

Andrew 8-)

_______________________________________________
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


  • Follow-Ups:
    • Re: How 'reliable' is MallocCheckHeap et al ?
      • From: Eric Albert <email@hidden>
  • Prev by Date: Re: How do you debug a C++ Standard Tool Application?
  • Next by Date: FAQ: How do you debug a C++ Standard Tool Application?
  • Previous by thread: using Xcode only as debugger interface
  • Next by thread: Re: How 'reliable' is MallocCheckHeap et al ?
  • Index(es):
    • Date
    • Thread