Re: [Modeling-users] unloading CustomObjects
Status: Abandoned
Brought to you by:
sbigaret
From: Mario R. <ma...@ru...> - 2003-07-23 06:55:40
|
Sebastien Bigaret wrote: > Yannick Gingras <yan...@sa...> wrote: >> Hi ! >> >> Once the object is loaded in an EditingContext, is there a way to >> unload it ? >> >> I don't want to kick it from the DB, just free some RAM... There is >> forgetObject() but the doc told not to use it. > > > First: you're completely right, forgetObject() is for internal use > only. > > You need EditingConext.refaultObject(). Don't search your local copy, > it > does not have it; I was sure this was implemented, and it is... but not > where I first expected to find it. > > Check the ml archives:; (this was in march) > https://sourceforge.net/mailarchive/ > forum.php?thread_id=1884326&forum_id=10674 > > I've quickly checked the implementation & at the test I proposed > there, so here is my suggestion: you can use it as-is, given that: > > - you're not applying it on deleted, inserted or modified objects, > (BTW: it will become an error to refault a deleted or an inserted > object) > > - you stick to EC.refaultObject and do not try to call > DBContext.refaultObject > > - you do not use it with a nested ec. > > (I'm not saying this won't work, it probably will... but it needs to > be tested before I can say this is supported). > > This request comes up on a regular basis, I guess I should consider > integrating it in the core. Any other vote for this, anyone? I can see this being very useful, My question is how do you keep track of which objects need to be freed? Do you do the bookkeeping separately? It might be nice to have EC's that automate this according to some criteria, such as, automatically drop (unfetch?) objects not accessed since 1 hour, or automatically unfetch all the least recently accessed objects beyond N, where N is some positive number (i.e. keep only the most recently accessed N objects). mario |