Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Are you running this code on a device or on the simulator? The simulator gives a bunch of false leaks (such as in AudioToolbox, CoreVideo, etc.). Also, the simulator seems to cache the <strong>entire</strong> video and not release it properly whereas the device buffers only what it needs along the way.</p> <p>I tested your code on the simulator with an mp4 video and I had similar results to what you were saying (10 live objects each time a video was played, with none dying... 20mb allocated, and 5mb left even after releasing). The living objects and memory allocation would keep growing and growing on the simulator.</p> <p>However, on my iPhone (with a 20mb video) it only allocated 900kb of memory total for the app, with no appreciable change when starting/stopping/releasing the video. It always stayed right around 900kb for the 10 times I tested it (starting/stopping/releasing). </p> <p>Looks like just another time you can't trust the simulator.</p> <p>The code I was testing with:</p> <pre><code>NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"SomeMovieFile" ofType:@"mp4"]]; MPMoviePlayerController *newPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; self.player = newPlayer; [newPlayer release]; [self.view addSubview:player.view]; // for my example, I didn't set the frame location, but no difference that would do [player play]; </code></pre> <p>Then in another button I stopped it and released the player:</p> <pre><code>[player.view removeFromSuperview]; player.initialPlaybackTime = -1; [player stop]; self.player = nil; // this is just a habit of mine.. calling stop should unload the buffers though [player release]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload