Reputation: 3246
I'm using CoreData
as my local app storage manager.
Sometimes I save BLOB
files (images, videos, etc) and I notice that the app size increases, which is expected.
My problem appears when I delete some data, but the app size doesn't change.
I've downloaded the app's container and noticed that the appname.sqlite
and appname.sqlite-wal
are still large.
Does anyone know why this is happening?
Note: I'm using CoreData with CloudKit with NSPersistentCloudKitContainer
if that can help.
Upvotes: 0
Views: 285
Reputation: 89152
Under CoreData is a sqlite database. Sqlite's vacuum
command documentation explains what is happening
https://www.sqlite.org/lang_vacuum.html
When content is deleted from an SQLite database, the content is not usually erased but rather the space used to hold the content is marked as being available for reuse.
You could try to connect to the underlying sqlite database and use vacuum directly on it.
How to VACUUM a Core Data SQLite db?
But, in your case, I'd follow @matt's suggestion of not using BLOBs this way.
Upvotes: 2