> On Feb 7, 2015, at 1:00 PM, Julian Paas <[email protected]> wrote:
> 
> However on the players list, the modelObjects seem to get garbage collected 
> because I frequently get new instances of player objects and have to 
> recalculate the stats. 

This is intentional. CBLDocument only keeps a weak reference to its associated 
model object*. And CBLDatabase only keeps strong references to the latest 50 or 
so CBLDocuments that have been accessed. This keeps huge numbers of objects 
from piling up in memory if you have a big database.

If you want specific model objects to stay in memory, you'll need to keep your 
own strong references to them, like from your own controllers or something like 
that.

—Jens

* Exception: If a model has unsaved changes, the database keeps a strong 
reference to it until it's saved, so the changes aren't lost.

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/05C9C903-E712-48EE-A494-E4AB600A0A43%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to