iphone sdk 4.1 memory leackage: may be scene repla

2019-06-07 00:17发布

问题:

I have used scheduler to return from a scene to the main menu. There is nothing in the scene page except menu. But scenes are not deallocating and memory leakage increasing as i navigate through the scenes. So application is not closing(kept running in background when close using iphone/ipod button) but crashing.

Hope some of you faced and resolved this type of problem.Expecting a way to out from here.

Here are my class sources-

Delegator

@implementation BubbleWordAppDelegate

@synthesize window;

- (void) applicationDidFinishLaunching:(UIApplication*)application
{
    CC_DIRECTOR_INIT();

    // Obtain the shared director in order to...
    CCDirector *director = [CCDirector sharedDirector];

    // Sets landscape mode
    //[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];

    // Turn on display FPS
    [director setDisplayFPS:NO];

    // Turn on multiple touches
    EAGLView *view = [director openGLView];
    [view setMultipleTouchEnabled:YES];

    // Default texture format for PNG/BMP/TIFF/JPEG/GIF images
    // It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
    // You can change anytime.
    [CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];    

//  [[CCDirector sharedDirector] runWithScene: [MainGameLayer scene]];
    [[CCDirector sharedDirector] runWithScene: [MenuScene node]];

}

- (void)applicationWillResignActive:(UIApplication *)application {
    [[CCDirector sharedDirector] pause];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [[CCDirector sharedDirector] resume];
}

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
    [[CCTextureCache sharedTextureCache] removeUnusedTextures];
}

- (void)applicationWillTerminate:(UIApplication *)application {
    [[CCDirector sharedDirector] end];
}

- (void)applicationSignificantTimeChange:(UIApplication *)application {
    [[CCDirector sharedDirector] setNextDeltaTimeZero:YES];
}

- (void)dealloc {
    [[CCDirector sharedDirector] release];
    [window release];
    [super dealloc];
}

@end

Menu Scene

#import "cocos2d.h"
#import "MenuScene.h"
#import "SettingsScene.h"
#import "AboutScene.h"
//#import "MainGameLayer.h"
#import "ErgoTransitions.h"

@implementation MenuScene

- (id) init
{
    self = [super init];
    if (self != nil) {
//      CCMenuItem *menuItem1 = [CCMenuItemFont itemFromString:@"Play" target:self selector:@selector(onPlay:)];
        CCMenuItem *menuItem2 = [CCMenuItemFont itemFromString:@"Settings" target:self selector:@selector(onSettings:)];
        CCMenuItem *menuItem3 = [CCMenuItemFont itemFromString:@"About" target:self selector:@selector(onAbout:)];

//      CCMenu *menu = [CCMenu menuWithItems:menuItem1, menuItem2, menuItem3, nil];
        CCMenu *menu = [CCMenu menuWithItems: menuItem2, menuItem3, nil];
        [menu alignItemsVertically];
        [self addChild:menu];
    }
    return self;
}
/*
- (void)onPlay:(id)sender
{
    NSLog(@"on play");
    [[CCDirector sharedDirector] replaceScene: [ErgoTransitions randomTransition:[MainGameLayer node]]];

}
*/

- (void)onSettings:(id)sender
{
    NSLog(@"on settings");
    [[CCDirector sharedDirector] replaceScene: [ErgoTransitions PageTransitionForward:[SettingsScene node]]];
//  [[CCDirector sharedDirector] replaceScene: [ErgoTransitions randomTransition:[SettingsScene node]]];
}

- (void)onAbout:(id)sender
{
    NSLog(@"on about");
    [[CCDirector sharedDirector] replaceScene: [ErgoTransitions PageTransitionForward:[AboutScene node]]];
//  [[CCDirector sharedDirector] replaceScene: [ErgoTransitions randomTransition:[AboutScene node]]];
}


@end

About Scene

#import "cocos2d.h"
#import "AboutScene.h"
#import "MenuScene.h"
#import "ErgoTransitions.h"

@implementation AboutScene

- (id) init
{
    self = [super init];
    if (self != nil) {
        CGSize winSize= [[CCDirector sharedDirector] winSize];

        CCSprite *bg = [CCSprite spriteWithFile:@"background2.png"];
        bg.position = ccp(winSize.width/2,winSize.height/2);
        [self addChild:bg];

        CCLabel *label = [CCLabel labelWithString:@"about scene" fontName:@"Arial" fontSize:20];
        label.position = ccp(winSize.width/2,winSize.height/2);
        [self addChild:label];

        [self schedule:@selector(onEnd:) interval:2];
    }
    return self;
}

- (void)onEnd:(ccTime)dt
{
    [[CCDirector sharedDirector] replaceScene: [ErgoTransitions PageTransitionBackward:[MenuScene node]]];
//  [[CCDirector sharedDirector] replaceScene: [ErgoTransitions randomTransition:[MenuScene node]]];
}


@end

Transaction Class (from cocos2d TestTransitions)

#import "cocos2d.h"
#import "ErgoTransitions.h"


#define TRANSITION_DURATION (1.2f)

//static int sceneIdx=0;
static NSString *transitions[] = {
    @"CCJumpZoomTransition",
    @"CCCrossFadeTransition",
    @"PageTransitionForward",
    @"PageTransitionBackward",
    @"CCFadeTRTransition",
    @"CCFadeBLTransition",
    @"CCFadeUpTransition",
    @"CCFadeDownTransition",
    @"CCTurnOffTilesTransition",
    @"CCSplitRowsTransition",
    @"CCSplitColsTransition",
    @"CCFadeTransition",
    @"FadeWhiteTransition",
    @"FlipXLeftOver",
    @"FlipXRightOver",
    @"FlipYUpOver",
    @"FlipYDownOver",
    @"FlipAngularLeftOver",
    @"FlipAngularRightOver",
    @"ZoomFlipXLeftOver",
    @"ZoomFlipXRightOver",
    @"ZoomFlipYUpOver",
    @"ZoomFlipYDownOver",
    @"ZoomFlipAngularLeftOver",
    @"ZoomFlipAngularRightOver",
    @"CCShrinkGrowTransition",
    @"CCRotoZoomTransition",
    @"CCMoveInLTransition",
    @"CCMoveInRTransition",
    @"CCMoveInTTransition",
    @"CCMoveInBTransition",
    @"CCSlideInLTransition",
    @"CCSlideInRTransition",
    @"CCSlideInTTransition",
    @"CCSlideInBTransition",
};


@interface FadeWhiteTransition : CCFadeTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface FlipXLeftOver : CCFlipXTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface FlipXRightOver : CCFlipXTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface FlipYUpOver : CCFlipYTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface FlipYDownOver : CCFlipYTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface FlipAngularLeftOver : CCFlipAngularTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface FlipAngularRightOver : CCFlipAngularTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface ZoomFlipXLeftOver : CCZoomFlipXTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface ZoomFlipXRightOver : CCZoomFlipXTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface ZoomFlipYUpOver : CCZoomFlipYTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface ZoomFlipYDownOver : CCZoomFlipYTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface ZoomFlipAngularLeftOver : CCZoomFlipAngularTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface ZoomFlipAngularRightOver : CCZoomFlipAngularTransition 
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface PageTransitionForward : CCPageTurnTransition
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end
@interface PageTransitionBackward : CCPageTurnTransition
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s;
@end


@implementation FlipXLeftOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationLeftOver];
}
@end
@implementation FadeWhiteTransition
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s withColor:ccWHITE];
}
@end

@implementation FlipXRightOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationRightOver];
}
@end
@implementation FlipYUpOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationUpOver];
}
@end
@implementation FlipYDownOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationDownOver];
}
@end
@implementation FlipAngularLeftOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationLeftOver];
}
@end
@implementation FlipAngularRightOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationRightOver];
}
@end
@implementation ZoomFlipXLeftOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationLeftOver];
}
@end
@implementation ZoomFlipXRightOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationRightOver];
}
@end
@implementation ZoomFlipYUpOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationUpOver];
}
@end
@implementation ZoomFlipYDownOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationDownOver];
}
@end
@implementation ZoomFlipAngularLeftOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationLeftOver];
}
@end
@implementation ZoomFlipAngularRightOver
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s orientation:kOrientationRightOver];
}
@end

@implementation PageTransitionForward
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s backwards:NO];
}
@end

@implementation PageTransitionBackward
+(id) transitionWithDuration:(ccTime) t scene:(CCScene*)s {
    return [self transitionWithDuration:t scene:s backwards:YES];
}
@end

@implementation ErgoTransitions

+(id) transitionWith:(NSString *) transitionName scene:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(transitionName);
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id) randomTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    short selectedTransition = [ErgoTransitions getRandomNumber:0 to:((short)sizeof(transitions) / (short)sizeof(transitions[0]))];
    Class transitionClass = NSClassFromString(transitions[selectedTransition]);
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id) JumpZoomTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCJumpZoomTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)CrossFadeTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCCrossFadeTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)PageTransitionForward:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"PageTransitionForward");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)PageTransitionBackward:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"PageTransitionBackward");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FadeTRTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCFadeTRTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FadeBLTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCFadeBLTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FadeUpTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCFadeUpTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FadeDownTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCFadeDownTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)TurnOffTilesTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCTurnOffTilesTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)SplitRowsTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCSplitRowsTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)SplitColsTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCSplitColsTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FadeTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCFadeTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FadeWhiteTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"FadeWhiteTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FlipXLeftOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"FlipXLeftOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FlipXRightOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"FlipXRightOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FlipYUpOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"FlipYUpOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FlipYDownOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"FlipYDownOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FlipAngularLeftOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"FlipAngularLeftOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)FlipAngularRightOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"FlipAngularRightOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)ZoomFlipXLeftOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"ZoomFlipXLeftOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)ZoomFlipXRightOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"ZoomFlipXRightOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)ZoomFlipYUpOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"ZoomFlipYUpOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)ZoomFlipYDownOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"ZoomFlipYDownOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)ZoomFlipAngularLeftOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"ZoomFlipAngularLeftOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)ZoomFlipAngularRightOver:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"ZoomFlipAngularRightOver");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)ShrinkGrowTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCShrinkGrowTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)RotoZoomTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCRotoZoomTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)MoveInLTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCMoveInLTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)MoveInRTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCMoveInRTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)MoveInTTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCMoveInTTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)MoveInBTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCMoveInBTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)SlideInLTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCSlideInLTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id)SlideInRTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCSlideInRTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id) SlideInTTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCSlideInTTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
+(id) SlideInBTransition:(CCScene*) scene withDuration:(ccTime) duration
{       
    Class transitionClass = NSClassFromString(@"CCSlideInBTransition");
    return [transitionClass transitionWithDuration:duration scene:scene];
}
//------ OverLoaded without Direction
+(id) transitionWith:(NSString *) transitionName scene:(CCScene*) scene
{       
    return [ErgoTransitions transitionWith:transitionName  scene:scene withDuration:TRANSITION_DURATION];
}
+(id) randomTransition:(CCScene*) scene
{       
    return [ErgoTransitions randomTransition:scene withDuration:TRANSITION_DURATION];
}
+(id) JumpZoomTransition:(CCScene*) scene
{       
    return [ErgoTransitions JumpZoomTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)CrossFadeTransition:(CCScene*) scene
{       
    return [ErgoTransitions CrossFadeTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)PageTransitionForward:(CCScene*) scene
{       
    return [ErgoTransitions PageTransitionForward:scene withDuration:TRANSITION_DURATION];
}
+(id)PageTransitionBackward:(CCScene*) scene
{       
    return [ErgoTransitions PageTransitionBackward:scene withDuration:TRANSITION_DURATION];
}
+(id)FadeTRTransition:(CCScene*) scene
{       
    return [ErgoTransitions FadeTRTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)FadeBLTransition:(CCScene*) scene
{       
    return [ErgoTransitions FadeBLTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)FadeUpTransition:(CCScene*) scene
{       
    return [ErgoTransitions FadeUpTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)FadeDownTransition:(CCScene*) scene
{       
    return [ErgoTransitions FadeDownTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)TurnOffTilesTransition:(CCScene*) scene
{       
    return [ErgoTransitions TurnOffTilesTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)SplitRowsTransition:(CCScene*) scene
{       
    return [ErgoTransitions SplitRowsTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)SplitColsTransition:(CCScene*) scene
{       
    return [ErgoTransitions SplitColsTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)FadeTransition:(CCScene*) scene
{       
    return [ErgoTransitions FadeTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)FadeWhiteTransition:(CCScene*) scene
{       
    return [ErgoTransitions FadeWhiteTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)FlipXLeftOver:(CCScene*) scene
{       
    return [ErgoTransitions FlipXLeftOver:scene withDuration:TRANSITION_DURATION];
}
+(id)FlipXRightOver:(CCScene*) scene
{       
    return [ErgoTransitions FlipXRightOver:scene withDuration:TRANSITION_DURATION];
}
+(id)FlipYUpOver:(CCScene*) scene
{       
    return [ErgoTransitions FlipYUpOver:scene withDuration:TRANSITION_DURATION];
}
+(id)FlipYDownOver:(CCScene*) scene
{       
    return [ErgoTransitions FlipYDownOver:scene withDuration:TRANSITION_DURATION];
}
+(id)FlipAngularLeftOver:(CCScene*) scene
{       
    return [ErgoTransitions FlipAngularLeftOver:scene withDuration:TRANSITION_DURATION];
}
+(id)FlipAngularRightOver:(CCScene*) scene
{       
    return [ErgoTransitions FlipAngularRightOver:scene withDuration:TRANSITION_DURATION];
}
+(id)ZoomFlipXLeftOver:(CCScene*) scene
{       
    return [ErgoTransitions ZoomFlipXLeftOver:scene withDuration:TRANSITION_DURATION];
}
+(id)ZoomFlipXRightOver:(CCScene*) scene
{       
    return [ErgoTransitions ZoomFlipXRightOver:scene withDuration:TRANSITION_DURATION];
}
+(id)ZoomFlipYUpOver:(CCScene*) scene
{       
    return [ErgoTransitions ZoomFlipYUpOver:scene withDuration:TRANSITION_DURATION];
}
+(id)ZoomFlipYDownOver:(CCScene*) scene
{       
    return [ErgoTransitions ZoomFlipYDownOver:scene withDuration:TRANSITION_DURATION];
}
+(id)ZoomFlipAngularLeftOver:(CCScene*) scene
{       
    return [ErgoTransitions ZoomFlipAngularLeftOver:scene withDuration:TRANSITION_DURATION];
}
+(id)ZoomFlipAngularRightOver:(CCScene*) scene
{       
    return [ErgoTransitions ZoomFlipAngularRightOver:scene withDuration:TRANSITION_DURATION];
}
+(id)ShrinkGrowTransition:(CCScene*) scene
{       
    return [ErgoTransitions ShrinkGrowTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)RotoZoomTransition:(CCScene*) scene
{       
    return [ErgoTransitions RotoZoomTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)MoveInLTransition:(CCScene*) scene
{       
    return [ErgoTransitions MoveInLTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)MoveInRTransition:(CCScene*) scene
{       
    return [ErgoTransitions MoveInRTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)MoveInTTransition:(CCScene*) scene
{       
    return [ErgoTransitions MoveInTTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)MoveInBTransition:(CCScene*) scene
{       
    return [ErgoTransitions MoveInBTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)SlideInLTransition:(CCScene*) scene
{       
    return [ErgoTransitions SlideInLTransition:scene withDuration:TRANSITION_DURATION];
}
+(id)SlideInRTransition:(CCScene*) scene
{       
    return [ErgoTransitions SlideInRTransition:scene withDuration:TRANSITION_DURATION];
}
+(id) SlideInTTransition:(CCScene*) scene
{       
    return [ErgoTransitions SlideInTTransition:scene withDuration:TRANSITION_DURATION];
}
+(id) SlideInBTransition:(CCScene*) scene
{       
    return [ErgoTransitions SlideInBTransition:scene withDuration:TRANSITION_DURATION];
}

+(short)getRandomNumber:(short)from to:(short)to 
{

    return (short)from + arc4random() % (to-from+1);

}

@end

Leakage screenshot-

EDITED:

I have removed transition- still leakage and app is not closing as i have explained above- here is the screen shot

回答1:

oh! memory leakage is solved. Now one problem left- App runs in background after closing it by pressing iPhone Home button( the only button).

How memory leakage is solved:

It was simple but tricky. it was about touch dispatcher and scheduler.

Unscheduling: If you switch scene from within a(and only) scheduled selector, then you need not to unschedule that selector. But if you switch scene from outside of scheduled selector or there is more than one scheduled selector then you must unschedule before switching.

Remove from Touch Dispatcher(if any) Remove current scene from Touch Dispatcher

did both of above before replacing current scene and it works fine. Every dealloc is calling properly :)