• 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: 'leaks' tool is inconsistent under otest
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'leaks' tool is inconsistent under otest


  • Subject: Re: 'leaks' tool is inconsistent under otest
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 08 Jul 2008 11:23:27 -0700

On Jul 8, 2008, at 10:29 AM, Jonathan del Strother wrote:
I have a framework which is tested with otest.  On exit, we test for
leaks, using much the same methodology as here -
http://www.cocoabuilder.com/archive/message/xcode/2008/5/26/21885

The results are a bit random.  It quite often misses leaks, only to
find them again in the next test run, despite having purposefully
introduced leaks that are quite clearly always present.

Any guesses why I'm seeing this non-deterministic behaviour?

Leaks works by scanning memory, looking for stuff that might be references to objects (where "object" means "an allocated hunk of memory" and not limited to "an Objective-C object"). Leaks simply scans every 4 bytes (32 bits, do the math for 64) to see if said bytes contain a value that could be construed as a pointer to somewhere. It has no knowledge of the layout of data structures, etc.


As such and because the leaks implementation quite explicitly tries to minimize false positives (thus suffering from more false negatives), leaks will often report inconsistent sets of leaks between runs because of garbage left in memory. In some cases, it may never find a particular leak because some fixed pattern of execution happens to consistently leave a reference behind that is never overwritten.

Fortunately, malloc offers the ability to scribble on memory before / after blocks are allocated / free'd. This vastly increases the accuracy of leak detection at the cost of performance (not a huge amount, though -- nothing like, say, gmalloc).

See x-man-page://malloc

b.bum

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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:
    • Any incompatibilities between loading the default Leopard developer tools and loading also an older version
      • From: "John F. Richardson" <email@hidden>
    • Why do PPC Tiger apps run on a Mactel Leopard system? [from an Xcode perspective]
      • From: "John F. Richardson" <email@hidden>
    • Re: 'leaks' tool is inconsistent under otest
      • From: "Jonathan del Strother" <email@hidden>
References: 
 >'leaks' tool is inconsistent under otest (From: "Jonathan del Strother" <email@hidden>)

  • Prev by Date: 'leaks' tool is inconsistent under otest
  • Next by Date: iPhone and Mac OSX configurations in the same project?
  • Previous by thread: 'leaks' tool is inconsistent under otest
  • Next by thread: Re: 'leaks' tool is inconsistent under otest
  • Index(es):
    • Date
    • Thread