Memory Warning / Crash when using media.capturePhoto

Hi, I’ve got an app that allows you to take and view photos.

Roughly 75% of the time on my iPhone 5s, the application crashes while opening the camera view, or just after the photo has been taken but before I tap “Use” to pass it back to Corona.

The logs indicate a Memory Warning. Using code from on this comment, I added some logging. My 2 memory warning logs look like this:

lowMemory warning - texture memory in use: 3.476 MB lua memory: 737.661 KB lowMemory warning - texture memory in use: 3.476 MB lua memory: 645.730 KB

Shortly afterwards, i get a “Exited: Killed: 9” for my app. This is shortly after starting the app, and seems to be happening with relatively low memory usage, if that log is correct.

Has anyone seen this before? It seems to be related to the camera specifically. My app has been fine with prolonged usage, but crashes often when launching the camera, even shortly after launch.

Any ideas?

Thanks!

Ben

Hi Ben,

We’ll probably need to see more code. Does the sample Camera project crash on your phone as well? Please build this project, test, and report back the results. It’s located in your local application directory here:

CoronaSDK > SampleCode > Media > Camera

Thanks,

Brent

Hey Brent, thanks for your response. I ended up restarting my phone, and the problem went away. If it starts cropping up again, I’ll try the sample project.

Thanks again!

Ben

BTW:  Those memory values are very low for your app.  The Lua memory is under 1 megabyte.  Your texture memory is  less than one 1024x1024 image.    I doubt that your app was the source of the low memory situation, which explains why rebooting cured this.  Something else that was running must have been hogging the memory.

Hi Ben,

We’ll probably need to see more code. Does the sample Camera project crash on your phone as well? Please build this project, test, and report back the results. It’s located in your local application directory here:

CoronaSDK > SampleCode > Media > Camera

Thanks,

Brent

Hey Brent, thanks for your response. I ended up restarting my phone, and the problem went away. If it starts cropping up again, I’ll try the sample project.

Thanks again!

Ben

BTW:  Those memory values are very low for your app.  The Lua memory is under 1 megabyte.  Your texture memory is  less than one 1024x1024 image.    I doubt that your app was the source of the low memory situation, which explains why rebooting cured this.  Something else that was running must have been hogging the memory.