大家好!
    我用Instruments检查内存时发现
[[SimpleAudioEngine sharedEngine] playEffect:INTO_SOUND_EFFECT_FILE];
    [[SimpleAudioEngine sharedEngine] unloadEffect:INTO_SOUND_EFFECT_FILE];[[SimpleAudioEngine sharedEngine] playEffect:INTO_SOUND_EFFECT_FILE]; 内存泄露。
请问大家这该如何解决
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:BACKGROUND_MUSIC_FILE loop:YES];
也如此

解决方案 »

  1.   

    #define INTO_SOUND_EFFECT_FILE @"into.mp3"
      

  2.   

    试试[[SimpleAudioEngine sharedEngine] playEffect:@"into.mp3"];
      

  3.   

    还是没解决,在运行[SimpleAudioEngine sharedEngine] 中就出现问题 最后看到 [CDAudioManager init: ]中AVAudioSession* session = [AVAudioSession sharedInstance]; 内存泄露100%
      

  4.   

    后面加
    [[SimpleAudioEngine sharedEngine]end];
      

  5.   


    没有[[SimpleAudioEngine sharedEngine] end]; 方法, 当我使用 [SimpleAudioEngine end]; 时异常- (void)ccTouchEnded:(UITouch*)touch withEvent:(UIEvent*)event
    {
        CGPoint location = [self convertTouchToNodeSpace:touch];
        
        CCSprite* homeButton = (CCSprite*)[spriteBatchNode getChildByTag:HOME_BUTTON_TAG_VALUE];
        // Reset button image (just in case the button is touched before)
        [homeButton setDisplayFrame:
         [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"home_button.png"]];
        
        if (CGRectContainsPoint(homeButton.boundingBox, location) && homeButton == previousTouchBeganObject)
        {
            SimpleAudioEngine* simpleAudio = [SimpleAudioEngine sharedEngine];
            [simpleAudio playEffect:OUT_SOUND_EFFECT_FILE];
    //        [simpleAudio stopBackgroundMusic];
            [SimpleAudioEngine end];
            
            AppController* delegate = (AppController*)[[UIApplication sharedApplication] delegate];
            [delegate switchToParentModule];  
            return;
        }
      

  6.   

    - (id)init
    {
        self = [super init];
        
        if (self) {
            self.touchEnabled = YES;
            
            if(![[SimpleAudioEngine sharedEngine] isBackgroundMusicPlaying]){
                [[SimpleAudioEngine sharedEngine] playBackgroundMusic:BACKGROUND_MUSIC_FILE loop:YES];
            }
      

  7.   

    我用 xcode5,  cocos2d: cocos2d-iphone v2.1