Join the Stack Overflow Community
Stack Overflow is a community of 6.2 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

Not sure that this is the right site for this question, but since there are many smart people here maybe someone knows.

I'm building an app that needs to capture video continuously, but keep only the last few minutes (say 5~15). It is easy to implement this by splitting the video to 30-seconds files, and delete the least recent ones. However, this means that the app writes and erases large files all the time, and I'm worried that it'll wear the device's flash memory.

I've been trying to find the P/E cycles spec for the iPhone (and for popular Android phones), with no success. Does anybody know the answer?

P.S. Just to alleviate a trivial concern: the device is connected to power during this video capturing, so battery depletion is not an issue.

share|improve this question

closed as off topic by martin clayton, tstenner, DNA, Andrew, Josh Caswell Sep 25 '12 at 17:02

Questions on Stack Overflow are expected to relate to programming within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Accepted answer doesn't take erase block size into consideration. Check this or this. Also appears wrong on 100k+ write cycle count. It is just 10k. Check write endurance section in wiki – Kiran Jun 19 at 5:17
up vote 2 down vote accepted

I wouldn't worry about that. Typical NAND flash has 100k+ write cycles

I'm sure iOS has a smart file operating system which distributes writes evenly to reduce wearing out specific locations. I'm also sure that once it starts happening with some sectors it marks them as bad ones and relocates them to healthy locations as it happens with normal HDDs as well.

Also writing on the same location in every 30 sec is not particularly frequent. It would take you 140 years to wear out the same flash location. I is likely that most of your data stays in the cache without actually ever written to the flash.

share|improve this answer
1  
Okay, so the calculation goes: A 30 seconds video capture on iPhone 4S is around 42MB. Assuming the device has only 16GB of flash, this means 390 files of 30 seconds video capture. With 100K P/E cycles this is equivalent of 39,000,000 files, which is ~37 years of continuous video capture. So Yeah, I guess this is enough. :) – Roy Sharon Sep 24 '12 at 8:31
1  
Wrong on 100k+ write cycle count part. It is just 10k. Check write endurance section in wiki – Kiran Jun 19 at 5:15

The number of erase cycles very much depends on the type of flash used. Single level NAND typically have 100k+ erase cycles whereas it's ~10k for multi-level NAND. As a rule of thumb, MLC is cheaper and higher density than SLC.

NAND controllers - whether implemented in software or in hardware perform wear-levelling, bad-block management and error correction, and some erase units are held back to replace blocks deemed to be beyond salvage.

There are a number of possible hardware architectures for attaching NAND devices in phones.

Apple is hanging (what I assume are) MLC devices directly off the applications processor.

A more common scenario in Android phones is to use a smallish NOR device for the bootloader and kernel and then an eMMC NAND Flash device with the ext4 filing system for everything else. eMMC is essentially the same silicon as removable media card. but packaged for direct mounting into a device, with embedded NAND array management.

in either case, the underlying NAND performance is considerably abstracted from application space. When you consider that MLC-based SSD devices are marketed at enterprise users who hammer them, any load generated on a smart-phone is unlikely to be a concern.

share|improve this answer
    
+1 for the detailed response. Thanks! – Roy Sharon Sep 24 '12 at 14:39
    
BTW, does this mean that the iPhone's P/E is ~10K and not ~100K? If so then my calculation above is order of magnitude wrong, bringing it to 3.7 years of continuous video capture (still enough, as most users will not use it continuously). – Roy Sharon Sep 24 '12 at 14:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.