I'm trying to understand the behavior of
Allows external storage properties to Core Data attributes and see if it will save me from manually storing files in the file system. I wanted to see how it would work when I was handling really large files. For that, I created a dummy project and saved a large file (2 GB) using Core Data. Then I monitored memory usage while retrieving and processing the data, and to my surprise they did not exceed 48 MB! Why? Does it capture the data in bits? If so, how? Does
Data structure APIs that allow core data to do that?
More details about what I did:
- Created a device
Filewith only two attributes,
Allows external storagefor the attribute
- Stored a 2 GB file in the device
- Retrieved the big file's data.
- Loops through the data, byte byte, read and XORing them.
- Monitored memory usage. [1
Datasince I did the same steps when loading
datafrom disk (
Data (contentOf: URL)) will result in 3+ GB of memory usage (also, why the extra 1 GB?).
Finally, is there any reason not to use
Does external storagefeature allow tead to manually store files in the file system? I know that this issue has been much discussed; but most of the points I read that suggest using the manual way were to mention performance issues with Core Data, even though my little experiment shows that Core Data is performing well.
Any help will be appreciated!