Memory leak with AVURLAsset and AVPlayer

I can reliably reproduce a memory leak when replacing the file asset of an AVPlayer object.


To demonstrate this leak, I modifiec the AVSimplePlayer example to reload a the file once a second. The memory usage increases ~ 1 MB with every file reload (depending on the file size).


I've uploaded the xcode project with the modifications here:

https://dl.dropboxusercontent.com/u/83824454/AVSimplePlayerOSX-modifiedtoshowleak.zip


the changes were simply to first disable ARC, and then replaceing windowControllerDidLoadNib and setUpPlaybackOfAsset with the following code:

- (void)windowControllerDidLoadNib:(NSWindowController *)windowController
{
  [super windowControllerDidLoadNib:windowController];
  self.player = [[AVPlayer alloc] init];

  [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(timerAction:) userInfo:nil repeats:YES];
}
- (void)timerAction:(id)sender
{
  AVURLAsset * asset = [AVURLAsset URLAssetWithURL:[self fileURL] options:nil];
  AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset];
  [self.player replaceCurrentItemWithPlayerItem:playerItem];
}


simply reloading the same asset causes the leak. commenting out the last two lines, so that only an AVURLAsset is created, causes a slow leak.


any thoughts, ideas or similar experiences are appreciated.

-rob

Please file a bug at bugreporter.apple.com - thanks!!!

Memory leak with AVURLAsset and AVPlayer
 
 
Q