> When I perform such operations, If I check ObjectAlloc? in Instrument.
> I Track down NSKeyValueObservance which have been allocated but not
> freed. they appear in red at 100% meaning that they were allocated but
> never released.They also consume I suppose GeneralBlocks? alongs whith
> those NSObject.
>
> The stack trace links down to line 1319 in SQLitePersistenObject.m for
> rev 135 in the init metod.
>
> I guess it's something normal, but I would think that using
> [SQLitePersistentObject clearCache] would remove all observers as
> well.
Hi Yohann,
The observer is only used on itself. SQLPO starts the observing in
its -init and then, IMO, should stop observing it in its -dealloc.
Currently, there are no calls to -removeObserver:forKeyPath: in SQLPO.
I would say you've found a memory leak. Yay!
Here is my patch for -dealloc:
- (void) dealloc
{
[[self class] unregisterObject:self]; // Remove this instance from
the cache.
// Stop observing ourselves.
for (NSString *oneProp in [[self class] propertiesWithEncodedTypes])
[self removeObserver:self forKeyPath:oneProp];
[super dealloc];
} // dealloc
> In general, has anybody developped for themselves good memory
> management practices when using SqlitePo in an app ?
If the above fixes your problem, then what are you looking for?
We should all remember that the lead architect of this project, Jeff
LaMarche, has chosen to focus his future efforts on exploiting Core
Data on the iPhone. I, myself, will be making that transition to Core
Data shortly after the release of the 3.0 code. IOW, I would not
expend too much effort trying to tightly embrace SQLPO in your project.
Anon,
Andrew