recent versions failing to catch omitted releases?

It seems like the last working version I have (0.195) no longer catches release leaks. Here’s how I test:

  1. pick an synthesized instance variable, eg:

GraphOverlayView *selectionView;

@property (nonatomic, retain) GraphOverlayView *selectionView;

@synthesize selectionView;

In this object’s dealloc, comment out the variable’s release:

  • (void)dealloc {
    // [selectionView release];
    }
  1. If I build with an old version:
    xcodebuild clean; ~/development/checker-0.147/scan-build -k -V xcodebuild

the missing release is detected:

missing ivar release (leak)

  1. But if I build with a recent version (0.195)

xcodebuild clean; ~/development/checker-0.195/scan-build -k -V xcodebuild

nothing is noted; there’s no output that includes the missing release.

Thanks,
Gary

Hi Gary,

That check has been disabled for quite some time. It was part of a larger set of checks (i.e., “missing -dealloc”) that produced far too many false positives to be enabled by default. The plan is to re-work those checks to produce far more acceptable results.

You are free to use these checks if you like. To do so, see the options from ‘scan-build -help’:

AVAILABLE ANALYSES (multiple analyses may be specified):

(+) -checker-cfref - Run the [Core] Foundation reference count checker
(+) -warn-dead-stores - Warn about stores to dead variables
(+) -warn-objc-methodsigs - Warn about Objective-C method signatures with type incompatibilities
-warn-objc-missing-dealloc - Warn about Objective-C classes that lack a correct implementation of -dealloc
(+) -warn-objc-unused-ivars - Warn about private ivars that are never used

The ones with the (+) are those that are run if no specific check options are provided. If you explicitly provide a check option, however, you must also explicitly provide the options of the other checks you want to run. This may change in the future.

The option you are interested in is -warn-objc-missing-dealloc.