Raspberry Pi Camera v2.1, image source: yadom.eu

Two weeks at a remote field site an hour from my office, I set up a Raspberry Pi with a Picamera v2.1 to take images every 15 minutes on a CRON task using the Python Picamera v1.13 software library. Four days later the software crashed with an out-of-memory error.

I drove out to the site and triaged the device. Before restarting the Raspberry Pi–while in its errored state–I was able to capture an image using the raspistill BASH command. This seemed to indicate to me that the error was somehow tied to Python. I discovered that I had the GPU setting on the Raspberry Pi set to 128 MB, the minimum setting required for the camera. So I updated the GPU memory to 256 MB and restarted the device and the Python script.

Eight days later the software crashed again with another out-of-memory error. This new information (twice the amount of memory and twice the amount of images) seems to indicate that the Python Picamera v1.13 library is setting GPU memory pointers but not releasing them. GPU memory is therefore filling up. Today I changed the python script to discontinue using the Python library and call the raspistill BASH command instead. Last summer the BASH command executed on a recurring CRON task for 3 months without any errors.