2
I’ve tried every way to destroy TDictionary
but whenever I have the ReportMemoryLeaksOnShutdown
Active he always leaves something untouched.
I’ve tried to run the list and destroy item by item.
Code:
with foDict.GetEnumerator do
while MoveNext do
Current.Value.Free;
foDict.Free;
As I tried to destroy only the foDict.Free;
Both there is memory leakage. Someone there has some suggestion?
Is this just your code where you use foDict? @Elanduartefraga
– Tmc
problem is just to give him a free pass. foDict: Tdictionary<integer, Tcliente>; It works perfectly but when releasing it from memory always gets some "garbage".
– Elan Duarte Fraga
tried my answer? @Elanduartefraga
– Tmc
I didn’t see how to test your answer but I created the project to better explain https://dl.dropboxusercontent.com/u/77323830/TDictionary.rar
– Elan Duarte Fraga
When you create a Dictionary, the best way to ensure that it will be released is to use the WnsValue parameter in create:
myDictionary<TKey,TValue>.Create([doOwnsValues])
– Victor Tadashi
And ai @Elanduartefraga , some advance ?
– Victor Tadashi
@Elanduartefraga if I could help with my answer, you can accept the answer by clicking on the left side of it. If you need any more help, let us know
– Tmc