• 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: Kernel extension debugging tool?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Kernel extension debugging tool?


  • Subject: Re: Kernel extension debugging tool?
  • From: Rob Barris <email@hidden>
  • Date: Wed, 16 Nov 2005 18:52:38 -0800


On Nov 16, 2005, at 2:20 PM, Sam Vaughan wrote:

On 17/11/2005, at 7:04 AM, Rob Barris <email@hidden> wrote:


     The "paranoid malloc" we use in game debugging does all that
stuff and adds one more wrinkle: freed memory blocks are immediately
scrubbed with a fill pattern but those blocks are put on a free list
and not allowed to be recycled for any other allocation til they cool
off a bit (seconds to minutes, depending how much bloat you can
tolerate and how much RAM you have).
     We have a watchdog that runs around all the freed blocks
periodically to make sure they are still scrubbed - if one isn't
scrubbed any more, it barks about it and dumps out the "who
allocated" and "who freed" call stacks, as well as showing which
offsets went sour.  Conversely any faulty code that reads from freed
blocks usually fails spectacularly enough that it's easy to spot
(regs full of F1F1F1F1 etc).  We call that "lazy free".  The same
watchdog also scans the live block list to make sure no block-end has
been overrun etc.

     Hashing call stacks / stack-crawls is very useful - we use 8 or
16 deep crawls.  So the meta data we have to keep for each live block
is just a uint for the allocator-path and the freer-path, an index
into the stack-crawl hash table.  That said we only invoke this tool
on machines with 2GB or more RAM handy.


Hi Rob,

You mentioned that this is for debugging games.  Does that mean you get to do all this in user space?  Half your luck ;o)

    Well, yeah.  And we only really intercept and track mallocs() & frees() that are called directly from our code, if something in Carbon or GL or BSD is doing double frees or write-after-free, we won't know about it.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Kernel extension debugging tool?
      • From: Quinn <email@hidden>
References: 
 >Re: Kernel extension debugging tool? (From: Sam Vaughan <email@hidden>)

  • Prev by Date: Re: Kernel extension debugging tool?
  • Next by Date: Re: Macnetworkprog Digest, Vol 2, Issue 229
  • Previous by thread: Re: Kernel extension debugging tool?
  • Next by thread: Re: Kernel extension debugging tool?
  • Index(es):
    • Date
    • Thread