• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data troubles - not removing objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data troubles - not removing objects


  • Subject: Re: Core Data troubles - not removing objects
  • From: Ben Trumbull <email@hidden>
  • Date: Sat, 3 Nov 2007 15:58:52 -0700

My problem is, that if I include a huge amount of data like an
uncompressed image that will swell the SQLite file to 72MB,

Generally, large media files should be stored externally to the database, and a URI and metadata for it stored in a database record.


removing the item does not reduce the file size. I found that if I add another
item later that should be around the same size the file size does not
change so what you wrote makes sense in that the "holes" inside the
file are filled up with new data but I can't get the file size to
reduce even by a few bytes.

What you're seeing is internal fragmentation.

I was thinking of maybe implementing a "consolidate database" function
that would load the data from the file to memory, remove the file and
recreate the items which would reduce the file size if I am correct.

That's very expensive.

Or does anyone have a better solution?

Yes. You can manually vacuum an SQLite database with:

sqlite3 filename "vacuum"

Programmatically, you can use an NSTask.

- Ben

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Core Data troubles - not removing objects
      • From: Benjámin Salánki <email@hidden>
  • Prev by Date: [MEET] November CocoaHeads Mac Developer Meetings
  • Next by Date: re: Locating managed objects within ObjectAlloc (was Re: Garbage collection, core data, and tight loops)
  • Previous by thread: Re: Core Data troubles - not removing objects
  • Next by thread: Re: Core Data troubles - not removing objects
  • Index(es):
    • Date
    • Thread