iPad Memory Management

Discussion in 'iOS Programming' started by JSDOS, Nov 20, 2010.

  1. JSDOS macrumors newbie

    Nov 20, 2010
    We have developed a game which seems to work flawlessly but crashes after 6 or 7 plays. I have thoroughly checked for leaks and do not think I have any but feel sure that crashes are memory related.

    I get a Memory Warning Level 1, then I see my viewDidUnload is called (usually several times in a row) then the game plays a bit longer and then just dies.

    When I run the program through leaks I do not see any leaks but do see all allocated objects rise steadily and I wonder if my architecture is wrong and I am just eating up all the memory.

    The game stacks xibs via [self presentModalViewController:viewController animated:YES]; so you get a configuration screen, then a Map screen, then the game screen, when the game is over you get a score screen. From the score screen I call a method in the appDelegate that tells the first controller to

    [self dismissModalViewControllerAnimated:YES];

    which dismisses the chain of stacked modal views.

    Does it really?

    I see the viewDidLoad get called each time I start a new game but are the previous game screens really gone?
  2. ianray macrumors 6502

    Jun 22, 2010
    Did you use the "Leaks" instrument?

    It is worth overloading the dealloc method, and setting a breakpoint (or inserting an NSLog) in order to understand when (and indeed whether) your classes are destructed.

Share This Page