Help with my project (and SD card life)


I’m pretty new to beagleboard and I’m getting a bit more into C programming – I wrote a program for my project to take a picture with a webcam, save the image file (using opencv) to a file (i.e. test.jpg), and then use Curl to upload that file to my webserver and delete the file locally.

I’m concerned that if run this every day, this will eventually wear out my SD card memory. Is this a valid concern? Is there a better way to structure my program so it avoids writing to the SD card? Can it capture the image and hold it in RAM? How does one do this in C? Right now I’m using something like this:



FILE *fp;
fp=fopen("test.jpg", "wb");
...//write to file

Look into tmpfs...

For example, adding this to your /etc/fstab would create a 5Mb tmpfs
out of ram..

tmpfs /var/ramfs tmpfs size=5M,mode=0777 0 0


If you're doing this once a day, no, don't worry about wear on the card.
If you're doing this at 30 frames per second, 24 hours per day, yes,
worry about wear on the card.

If you're in between those two, pick the one you're closer to and use
that as my answer. Or if you are risk averse or don't like my answer,
take Robert's suggestion and use a tmpfs.