App Groups disk usage

I'm trying to use App Groups capability to enable file sharing between my multiple apps. But i'm wondering which app will be counted as the disk space occupier when I write a file to the shared path?

Thanks for your consideration.

First off, as a disclaimer, the EXACT details of how this is calculated are a lot more complicated than they might seem and have varied across system implementations. What I'm describing is a quick summary of how and why this works, not an exhaustive description across multiple system versions and all possible configuration.

SO, short answer, I believe the shared data will be "counted" against both apps and, yes, that means there will be "double counting".

The background here is that the system is being asked to present a straightforward number for something that simply ISN'T straightforward.

A few examples of the issues here:

  • Group containers are used to share data "across" apps (meaning to apps that were independently installed), but they're also used to share "within" an app (for example, between the parent app and it's extension). Adding to the fun, the same app group is often used to share data to both cases.

  • If you try to "split" the data across the top level apps, it creates a situation where deleting one app would then increase the usage of another. It's already the case that deleting an app may not return it's full freed storage (and that's VERY hard to "fix"), but having the additional confusion of individual apps usage changing is arguably worse.

  • Keep in mind that just calculating the storage is extremely messy. Things like hard links and file cloning mean that the "perceived" storage ("Add up the size of every file") and the ACTUAL storage ("How much space is the file system actually using to store this") can easily be quite different. More to the point, the sorting out those different values only makes things slower.

  • Differentiating between all the edge cases can't really be done quickly and performance is a huge issue here.

Kevin Elliott, DTS Engineer, CoreOS/Hardware

App Groups disk usage
 
 
Q