iOS disk full?

  • I know iOS will give your app the didReceiveMemoryWarning:, but what about if you try to use all the available space? (i.e. your iDevice is stuffed with music, videos, apps, photos, and so on) Should the app just catch an NSException?
      What's the Apple recommended way of playing nice w/regards to writing files or sqlite3 databases that may grow to be too big?
  • On Jun 18, 2012, at 5:08 PM, William Squires wrote:

    > I know iOS will give your app the didReceiveMemoryWarning:, but what about if you try to use all the available space? (i.e. your iDevice is stuffed with music, videos, apps, photos, and so on) Should the app just catch an NSException?

    Fundamentally, you'll get errors from file operations that fail due to insufficient disk space. The errors depend on the API; e.g. for POSIX calls you'll see ENOSPC.

    However, running out of disk space is a pretty bad situation for the OS as a whole, so generally it doesn't let things get that far. As disk space runs out it'll start notifying the user, and it might also start freezing apps (OS X does this.) In the worst case, you can pretty much lock up the whole device if space runs out.

    If your app has the potential to create large files, it would be polite to preflight disk space and stop writing if the free space gets below a few hundred megabytes.

    —Jens
  • On 19.06.2012, at 02:55, Jens Alfke wrote:
    > Fundamentally, you'll get errors from file operations that fail due to insufficient disk space. The errors depend on the API; e.g. for POSIX calls you'll see ENOSPC.
    >
    > However, running out of disk space is a pretty bad situation for the OS as a whole, so generally it doesn't let things get that far. As disk space runs out it'll start notifying the user, and it might also start freezing apps (OS X does this.) In the worst case, you can pretty much lock up the whole device if space runs out.

    Not really. On Mac OS X, you can freeze it up because you will no longer have swap space, which causes both hard disk and RAM to be full. On iOS, there is no virtual memory for RAM, so apps will not have too many problems unless they try to write more to the disk and can't handle that.

    > If your app has the potential to create large files, it would be polite to preflight disk space and stop writing if the free space gets below a few hundred megabytes.

    Something we do when recording to disk is look at the disk space periodically, and if it goes below a certain limit (but isn't yet completely full), abort the recording and inform the user. Don't let it come to a point where you actually fill the disk.

    Cheers,
    -- Uli Kusterer
    "The Witnesses of TeachText are everywhere..."
previous month june 2012 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
Go to today