Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6836037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:18:22+00:00 2026-05-26T23:18:22+00:00

I am having problem when I use pushViewController – Memory goes to 28 MB

  • 0

I am having problem when I use pushViewController – Memory goes to 28 MB from 9 MB, but using popViewController does not releases the memory (supposed to become 9 MB) but I am getting 28 MB.

Below is the code that pushes the view.

/* Video Handler */
-(void)showVideo:(id)sender {
    UIButton *btn               = (UIButton *)sender;
    int nid                         =   btn.tag;

    masterdb *mdbT          = [[masterdb alloc] init];
    izc_news *nclsT         =   [mdbT getNewsDetail:nid];
    [mdbT release];
    NSString *vlink         =   nclsT.VideoLink;

    PlayVideo *vd               =   [[PlayVideo alloc] init];
    vd.hidesBottomBarWhenPushed =   YES;
    vd.videoLink                =   vlink;

    [self.navigationController pushViewController:vd animated:YES];
    [vd release];
    vd                                  =   nil;
}

Below is the PlayVideo.h file

#import <MediaPlayer/MediaPlayer.h>

@interface PlayVideo : UIViewController {
    NSString *videoLink;
    MPMoviePlayerController *mp;
    UIActivityIndicatorView *spinner;
}

@property(nonatomic, retain) NSString *videoLink;
@property(nonatomic, retain) MPMoviePlayerController *mp;
@property(nonatomic, retain) UIActivityIndicatorView *spinner;

@end

and finally below is the PlayVideo.m file

#import "PlayVideo.h"


@implementation PlayVideo

@synthesize videoLink; 
@synthesize mp;
@synthesize spinner;


- (void) viewDidLoad {

    [super viewDidLoad];

    videoLink       =   @"http://www.izooconnect.com/fwzNew/vids/testVid.mov";

    [[UIApplication sharedApplication] setStatusBarHidden:YES];

    [[self view] setBounds:CGRectMake(0, 0, 480, 320)];
    [[self view] setCenter:CGPointMake(160, 240)];
    [[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; 


    CGRect mainBounds               = [[UIScreen mainScreen] bounds];
    CGRect indicatorBounds  = CGRectMake(mainBounds.size.height / 2 - 24, mainBounds.size.width / 2 - 24, 48, 48);
    spinner                                 =          [[UIActivityIndicatorView alloc] initWithFrame:indicatorBounds];
    spinner.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
    spinner.tag                         =   1;
    [spinner startAnimating];
    [self.view addSubview:spinner];


    mp =  [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString: videoLink]];


    [[NSNotificationCenter defaultCenter] addObserver:self 
                                                                                 selector:@selector(moviePreloadDidFinish:) 
                                                                                         name:MPMoviePlayerContentPreloadDidFinishNotification 
                                                                                     object:nil];


    [[NSNotificationCenter defaultCenter] addObserver:self 
                                                                                 selector:@selector(moviePlayBackDidFinish:) 
                                                                                         name:MPMoviePlayerPlaybackDidFinishNotification 
                                                                                     object:nil];


[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];

    [[mp view] setFrame:CGRectMake(0, 0, 480, 320)];

    [mp setControlStyle:MPMovieControlStyleFullscreen];
    [mp setFullscreen:YES];

    [self.view addSubview:mp.view];

}


- (void) moviePreloadDidFinish: (NSNotification *) notification {
    UIActivityIndicatorView *tmpimg = (UIActivityIndicatorView *)[self.view viewWithTag:1];
    [tmpimg removeFromSuperview];
    [mp play];
}


- (void) moviePlayBackDidFinish: (NSNotification *) notification {
    [self.navigationController popViewControllerAnimated:YES];
}




- (void) dealloc {
    [mp release];
    [spinner release];
    [super dealloc];
}

@end

Tried to locate the problem but failed to find any.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:18:23+00:00Added an answer on May 26, 2026 at 11:18 pm

    Your problem is here

    - (void) moviePlayBackDidFinish: (NSNotification *) notification {
        mp  =   nil;
        [self.navigationController popViewControllerAnimated:YES];
    }
    

    you are setting mp = nil without releasing it and when you release in dealloc, it sends the message to nil and not to the actual instance of mp.

    release mp and then set it to nil.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm having problem when i want to use regexp, i don't know to using
I usually use XCode but was having a problem opening a file with this
I am having a problem trying to use the prependTo() function in jQuery... for
I am having a problem getting WinDbg to use the PDB files for my
I'm having a problem with image scaling. When I use the following code to
I am having a strange problem: In -(void)viewWillAppear:(BOOL)animated method I use: [[UIApplication sharedApplication] setStatusBarHidden:YES
I'm having a strange problem. I have to use GetPostBackEventRefence to force a Postback,
Having a bit of a problem, Due to the source-control set-up we use, each
I've managed to use Sun's MSCAPI provider in my application. The problem I'm having
i'm having problem when i want to select element using querySelector <ul class=xoxo blogroll>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.