Memory Problem

Discussion in 'iOS Programming' started by testgame, Aug 18, 2010.

  1. testgame macrumors newbie

    Jun 9, 2010

    I have memory problem in my application. I am integrating some application in one application.

    Following is my problem:
    -I have one UIView named MainView.
    At this time memory usage is 9.0 mb.

    -now i am adding another view on it.
    Memory usage increase to 13-15 mb.

    - When i release that newly added view from superview. [self removefromsuperview];
    Memory is 9.5 mb. it's not 9.0 mb.

    - As i open more views memory increases.

    I release all the objects & controls i take in that view.

    Pls help me to solve this problem.

    Thanks in Advance.
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    Without the code it is impossible to help: you are most likely allocating memory and not releasing it.
  3. sherry2009 macrumors newbie


    Dec 14, 2009
    Are you release it

    release that newly added view ,not just [self removefromsuperview],also [newly_added_view release];Are you release it?
  4. testgame thread starter macrumors newbie

    Jun 9, 2010
    Thanks for your reply.

    I have one mainView. It contains button 1 to 5.

    When I click on button 1, I write following code.

    view1 *view = [[view1 alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
    [self.superview addSubview:view];
    [view release];

    & in view1 i write [self removeFromSuperView]; To go back to mainView.
    I release all the objects i took in view1.

    At this time memory problem occurs. As I click on more buttons & add more views memory increases even i m removing it.

Share This Page