• 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
Re: MallocGuardEdges not finding buffer overrun
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MallocGuardEdges not finding buffer overrun


  • Subject: Re: MallocGuardEdges not finding buffer overrun
  • From: Eric Albert <email@hidden>
  • Date: Tue, 16 Jan 2007 17:45:48 -0800

On Jan 16, 2007, at 5:04 PM, David Dunham wrote:

I've never had luck using MallocGuardEdges to catch a buffer overrun. And we had one today it didn't catch.

Our game on Windows was clearly crashing due to the heap getting stomped, but we weren't having luck finding it there. Since almost everything is cross-platform, I tried tracking it down on a Mac. There was no crash, but I assumed that was because the memory that got stomped was more benign. Still, I hoped that MallocGuardEdges would tell me what was going on.

It didn't. I know I had it enabled correctly because the console output includes

(3862) malloc: protecting edges

and my allocation is 9980 bytes (it's a C++ "new" but I presume this counts), big enough to be guarded.

Is there something I'm missing?

(I eventually found where I'd asked a similar question, and Daniel Jalkut pointed me at Guard Malloc. I enabled this in Xcode, waited a very long time, and it crashed at the right spot. But like the docs say, this makes your app run 100x as slow, so I'd much rather use the relatively speedy MallocGuardEdges.)

Looking at the source code for Libc, MallocGuardEdges adds guard pages whenever malloc grabs new pages from the VM system. In other words, it guards malloc regions, not individual allocations. That makes it far less useful for tracking down overruns (or, rather, for just about anything) than you'd like. Guard Malloc is the best option we have for tracking down overruns today. In my experience Guard Malloc runs quite a lot faster (albeit still very slowly) on Intel systems with lots of RAM, so if you were doing this work on PowerPC you might want to give an Intel Mac a shot.


Hope this helps,
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


  • Follow-Ups:
    • Re: MallocGuardEdges not finding buffer overrun
      • From: David Dunham <email@hidden>
References: 
 >MallocGuardEdges not finding buffer overrun (From: David Dunham <email@hidden>)

  • Prev by Date: Re: Tip: How to add an Xcode template timestamp macro
  • Next by Date: Re: Tip: How to add an Xcode template timestamp macro
  • Previous by thread: MallocGuardEdges not finding buffer overrun
  • Next by thread: Re: MallocGuardEdges not finding buffer overrun
  • Index(es):
    • Date
    • Thread