Camera bug: Memory leak

Hello there,

Is it possible that the camera functions or somewhere else are having a memory leak? This is a very critical bug, on an app that takes many pictures from the camera daily.

The app is already developed for a good time, and seems like it didn’t happen before. But after doing some heavy use of the camera, the memory usage reported by android goes way high (maxs on around 200Mb, when the app gets killed later), while the in code memory (from lua garbage collector) displays 1 or 2Mbs of RAM and around 10-15Mbytes of video memory.

The story does not end here. On android 4.1.2 (tested on samsung S3), the app just dies after reaching some high memory, however, on a nexus 4 (android 4.4.2) not only the app crashes, but the operative system is unable to recover the leaked memory. From a 2GB device, it ends up with around 180MB free RAM after taking pictures for 5 minutes. The app dies and the device needs to be restarted.

Pictures are saved to disk (storage) with the media.capturePhoto function. And then used and deleted later. I doubt that this helps, but “using” the image includes opening it, loading it into memory, convert it to base64, send it to a server though an HTTP POST request, closing the file, and deleting the file.
However, this only happens if the user has internet access, otherwise, picture files are saved and not touched by anything, yet the problem still happens this way.

The camera issue on Android was fixed sometime ago in the daily builds. If you have the latest daily build, i guess it is the memory (see texture memory) where if it hits max, the app will ‘die’.

if you are handling photos, try to resize it to a smaller image before displaying it on screen (see display.capture() function).

I do have an app where a user takes ~10 photos and shows the user the thumbnail (app will resize it to ~300x300px, much smaller filesize), and then FTP-upload it when done. So far, it has been stable.

Hope this helps.

I believe this was fixed before the latest public release (2393a Mac, 2393 Windows).  Make sure you’re using that build or later.

Rob

We are using that build. 

The camera issue on Android was fixed sometime ago in the daily builds. If you have the latest daily build, i guess it is the memory (see texture memory) where if it hits max, the app will ‘die’.

if you are handling photos, try to resize it to a smaller image before displaying it on screen (see display.capture() function).

I do have an app where a user takes ~10 photos and shows the user the thumbnail (app will resize it to ~300x300px, much smaller filesize), and then FTP-upload it when done. So far, it has been stable.

Hope this helps.

I believe this was fixed before the latest public release (2393a Mac, 2393 Windows).  Make sure you’re using that build or later.

Rob

We are using that build.