Swift AVMIDI播放器泄漏内存

Swift AVMIDI播放器泄漏内存,swift,ios8,avfoundation,midi,Swift,Ios8,Avfoundation,Midi,我想用AVMIDI播放器在iOS 8.2上播放MIDI文件 这确实有效,但时间很短:内存似乎永远不会被释放,最终会被填满 下面是我在Swift 1.2中的代码,简化为最低限度:一切都发生在ViewController中,没有其他类,没有委托,没有错误检查,等等 该界面只有三个按钮:NEW(实例化一个新的AvmidPlayer和prerolls)、PLAY、STOP 这种内存问题发生在模拟器和实际设备上,soundfont和MIDI文件越大,情况就越糟 我注意到,当创建一个新的AVMIDIPlay

我想用AVMIDI播放器在iOS 8.2上播放MIDI文件

这确实有效,但时间很短:内存似乎永远不会被释放,最终会被填满

下面是我在Swift 1.2中的代码,简化为最低限度:一切都发生在ViewController中,没有其他类,没有委托,没有错误检查,等等

该界面只有三个按钮:NEW(实例化一个新的AvmidPlayer和prerolls)、PLAY、STOP

这种内存问题发生在模拟器和实际设备上,soundfont和MIDI文件越大,情况就越糟

我注意到,当创建一个新的AVMIDIPlayer实例和播放MIDI文件时,RAM会增加(在后一种情况下,甚至可以获得+4Mb/秒)

我错过了什么

谢谢你的帮助

import UIKit
import AVFoundation

class ViewController: UIViewController {
    var mp:AVMIDIPlayer?

    @IBAction func newButton(sender: AnyObject) {
        mp = AVMIDIPlayer(contentsOfURL: NSBundle.mainBundle().URLForResource("ahVous", withExtension:"mid"),
                           soundBankURL: NSBundle.mainBundle().URLForResource("TimGM6mb", withExtension:"sf2"),
                                  error: nil)
        mp!.prepareToPlay()
    }
    @IBAction func playButton(sender: AnyObject) {
        mp!.play(nil)
    }
    @IBAction func stopButton(sender: AnyObject) {
        mp!.stop()
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}