Memory leak in iTunes Library Framework

Originator:mail
Number:rdar://15936216 Date Originated:29.01.2014
Status:open Resolved:
Product:OS X SDK Product Version:10.9.1
Classification:Serious Bug Reproducible:Always
 
Summary:
When creating an instance of the ITLibrary object, the framework leaks memory. The exact amount seems to depend on the library size. Since you need to create a new instance of the library object every time you need fresh data, this makes the framework useless for any long-running app that needs regular access to the iTunes library.

Steps to Reproduce:
1. Create an XCode project with ARC and sandboxing enabled.
2. Add the ITunes Library framework to the project.
3. Add the following to you app delegate's header:

#import <iTunesLibrary/ITLibrary.h>
#import <iTunesLibrary/ITLibMediaItem.h>
#import <iTunesLibrary/ITLibArtist.h>
#import <iTunesLibrary/ITLibAlbum.h>

4. Add this code to your delegates source file:

- (void) awakeFromNib {
    NSError *err;
    ITLibrary *itlib;
   itlib = [ITLibrary libraryWithAPIVersion:@"1.0" error:&err];
   itlib = nil;
 }

5. Build and run the app in Instruments' leaks tool.

Expected Results:
The app should run without any memory leaks.

Actual Results:
Instruments will show multiple objects being leaked by just creating the  object. If you repeat the call via NSTimer you will see a new leak every time itlib = [ITLibrary libraryWithAPIVersion:@"1.0" error:&err] is being called.

Version:
Version 5.0.2 (5A3005), OS X 10.9.1 (13B42)

Notes:


Configuration:
 iTunes 11.1.4

Comments


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!