Alex Rivera | Logout

iOS app being killed (jettisoned) by mediaserverd memory issue (leak?) while streaming video

Asked 2012-08-07T17:42:38.357
8

We are seeing a strange crash in which it appears that iOS is jettisoning our app along with mediaserverd after receiving a level 2 memory warning. It occurs while streaming DRM content (including, but not limited to, PlayReady encrypted content) about 7-8 minutes into playback - even if we have restarted the device with no other applications running in the background. This does not happen consistently, however, and we can sometimes complete the same piece of content (an entire 2 hour movie) with numerous memory-heavy applications in the background without any issues.

We are seeing this on iPhone 3GS, 4, and 4S devices running iOS 5.1 and 5.1.1, though it appears to be most prominent on a 3GS. The app is be terminated with either "segmentation fault 11" or "signal 9". Segmentation fault 11 can refer to bad memory access or low memory and signal 9 refers to low memory termination.

We have used both the static analyzer and instruments to find and fix any leaks and nothing alarming shows up in the Leaks instrument.

When analyzing playback using the Memory Monitor instrument, we see a dramatic decrease in available physical memory when we begin streaming, which is to be expected to a certain extent. When the application/os is behaving normally, other applications are removed from the background when memory becomes too low, but occasionally the available physical memory will simply continue to drop until the OS kills our app. No crash logs are generated, although we occasionally receive Low Memory logs, like the one below:

Incident Identifier: 13839D5B-D280-40D8-8C67-6EE3D61394C3
CrashReporter Key:   d3746ff556543d6a94e067d82c8fb379a285f543
Hardware Model:      iPhone2,1
OS Version:          iPhone OS 5.1.1 (9B206)
Kernel Version:      Darwin Kernel Version 11.0.0: Sun Apr  8 21:50:49 PDT
2012; root:xnu-1878.11.10~1/RELEASE_ARM_S5L8920X
Date:                2012-06-28 14:09:56 -0400
Time since snapshot: 104 ms

Free pages: 
Edit
Report

1 Answer

2

This is just a blind guess, but aren't you using AVFoundation's AVPlayer? I had an issue like this, it turned out I wasn't releasing AVPlayers correctly. So for every song I created a new AVPlayer, which is fine if you release the old, but I didn't. I found it out by doing an allocation test in Instruments and saw AVPlayers remain living after they supposed to be released.

answered 2012-12-18T12:47:48.840

Your Answer