I am running a computer vision program on a Raspberry Pi (Linux raspberrypi 3.10.19+), and when it firsts begins, each iteration of the main loop runs in 6 ms. After a few seconds, the time per loop increases to 50 ms, and then switches between 6 and 50 ms every 10 seconds or so. Why might this be happening?
I have checked very carefully and I am pretty sure there are no memory leaks. The process remains at 3.9% memory usage the whole time. I have tried increasing the priority of the process (nice -n -19) but that didn't work.
When I take out all of my vision processing and simply pull frames from the camera, the speed of the process does not exhibit this changing behavior, so I don't think it has to do with the camera.
The only thing I can think of is that some memory (maybe the cache?) is filling up and then slowing things down, and then getting cleared out every so often, thus speeding things up again.
Thanks!