• 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 not showing my leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: Leaks not showing my leak


  • Subject: re: Leaks not showing my leak
  • From: Dave Payne <email@hidden>
  • Date: Wed, 13 Jul 2005 10:13:49 -0700

On Jul 11, 2005, Tom Bernard <email@hidden> wrote:

I wrote a small app to see the command line tool leaks in action. The app,
Leak Study 
<http://bersearch.com/MacOSXSoftware/TomsCocoaSoftware/Leak.Study.050709.001
3.zip>, waits 15 seconds, then sets up a repetitive timer to leak 1M every
10 seconds. When I run leaks after each allocation, leaks shows 2 leaks that
appear to belong to Cocoa (see the stack trace), but does not show the 1M
leak allocated by my app. Leaks does show the allocation for the app
increased by a megabyte for each timer event.

The attached sample is after several allocations and should show each of
those allocations as a 1 megabyte leak. The sample only shows the 2 leaks
that occurred at launch.

While checking the archives, I saw a reference to a bug with dead-code
stripping that affected the leaks tool, and another reference to zero-link.
For what its worth, I rebuilt the app with dead-code stripping and zero-link
disabled which gave the same results.

Why is leaks not detecting my 1 megabyte allocation as a leak? What am I
missing?

Tom, thanks for your report.  It appears that you've found a problem in 'leaks'.  'leaks' uses a conservative algorithm of looking through all the writable memory regions in your process, searching for 4-byte patterns that appear to be pointers to malloc blocks.  But, it currently considers anything that appears to be a pointer into anywhere in the middle of a malloc'ed block to also be a reference to that block.  With blocks of 1 MB, it's finding a number of 4-byte patterns that point into the middle of your malloc'ed blocks.  This technique reduces the risk of "false positive" reports of leaks, but is unfortunately more likely to miss large leaks.

We'll look at improving the heuristics for this for a future release.

Note that the MallocDebug application uses a different algorithm for detecting leaks, and I do see it reporting those large leaks in your test application.

- Dave

 _______________________________________________
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: Leaks not showing my leak
      • From: Tom Bernard <email@hidden>
  • Prev by Date: Re: Deployment builds hang instead of crashing
  • Next by Date: Re: Perforce
  • Previous by thread: Leaks not showing my leak
  • Next by thread: Re: Leaks not showing my leak
  • Index(es):
    • Date
    • Thread