MMLeak Dictionaray TOrderedEnumerable => TContainedIterator
Issue #35
invalid
For my understanding:
Contained objects get destroyed by their parent/controller.
TOrderedEnumerable in the dictionary just don't want that the parent is destroyed, because it holds a not reference counted pointer to it.
procedure Test;
var
X: IDictionary<string, string>;
L: TPair<string, string>;
begin
X := TCollections.CreateDictionary<string, string>; // Inc ref counter to X => 1
X.AddOrSetValue('1','42');
X.AddOrSetValue('3','42');
X.AddOrSetValue('9','42');
for L in X.Ordered do // Inc ref counter to X => 2
ShowMessage(l.Key);
// Dec ref counter to X => 1
end; // Dec ref counter to X => 0
// Ordered is still alive => mm leak
This could be a bug in TDictionary<TKey, TValue>.TKeyCollection, TDictionary<TKey, TValue>.TValueCollection and TMultiMapBase
My dirty hot fixe for the TOrderedEnumerable:
Comments (2)
-
Account Deleted -
Account Deleted - changed status to invalid
orry => I already moved it to spring4d
- Log in to comment
sorry => I already moved it to spring4d