Memory Leaks on UIAlertController.

Originator:absessive
Number:rdar://21220974 Date Originated:03/06/2015
Status:Open Resolved:No
Product:iOS Product Version:8.3
Classification:Performance Reproducible:Yes
 
Summary:
When running memory leaks profiling on an app with UIAlertControllers, always gets a leak once the UIAlertControllers are dismissed.

Steps to Reproduce:
Unzip the tar file.
1. Profile the provided sample app for memory leaks on a device running IOS 8.3 using XCode 6.3.2.
2. Once profiling starts and the app is open, hit the on screen button to display an alert.
3. Dismiss the alert.
4. Wait for a few seconds. Instruments shows a memory leak.

Expected Results:
No memory leaks.

Actual Results:
1. A memory Leak occurs on UIAlertController with the following stack trace. The leaked object is NSMutableArray.

   0 libsystem_malloc.dylib malloc_zone_calloc
   1 libsystem_malloc.dylib calloc
   2 libobjc.A.dylib class_createInstance
   3 CoreFoundation __CFAllocateObject2
   4 CoreFoundation +[__NSArrayM __new:::::]
   5 CoreFoundation -[__NSPlaceholderArray initWithCapacity:]
   6 UIKit _UIAlertControllerCommonInit
   7 UIKit -[UIAlertController initWithNibName:bundle:]
   8 UIKit +[UIAlertController alertControllerWithTitle:message:preferredStyle:]
   9 AlertsMemoryLeak -[ViewController handleButtonClick:] /Users/ac028761/Study/IOS/AlertsMemoryLeak/AlertsMemoryLeak/ViewController.m:30
  10 UIKit -[UIApplication sendAction:to:from:forEvent:]
  11 UIKit -[UIControl sendAction:to:forEvent:]
  12 UIKit -[UIControl _sendActionsForEvents:withEvent:]
  13 UIKit -[UIControl touchesEnded:withEvent:]
  14 UIKit -[UIWindow _sendTouchesForEvent:]
  15 UIKit -[UIWindow sendEvent:]
  16 UIKit -[UIApplication sendEvent:]
  17 UIKit _UIApplicationHandleEventFromQueueEvent
  18 UIKit _UIApplicationHandleEventQueue
  19 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
  20 CoreFoundation __CFRunLoopDoSources0
  21 CoreFoundation __CFRunLoopRun
  22 CoreFoundation CFRunLoopRunSpecific
  23 CoreFoundation CFRunLoopRunInMode
  24 GraphicsServices GSEventRunModal
  25 UIKit UIApplicationMain
  26 AlertsMemoryLeak main /Users/ac028761/Study/IOS/AlertsMemoryLeak/AlertsMemoryLeak/main.m:14
  27 libdyld.dylib start


Version:
iOS 8.3(12F69), XCode 6.3.2

Notes:


Configuration:
iPod Touch 5th generation, iPad 4th generation.

Comments

Apple closed this as a duplicate.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!