Delphi Spring4D IList Memory Overflow

I am using IList from the excellent Delphi Spring4D platform from Stefan Glienke.

I have an IList list, and I repeatedly populate this list during the launch of my application. So, after two or three hours, I have a memory overflow on my list.

Here is how I fill out my list:

list := TCollections.CreateList<TVisitor>; for i := 0 to dataSet.RecordCount - 1 do begin item := TVisitor.Create (); item.Surname := dataSet.FieldByName ( 'firstname' ).AsString; item.Name := dataSet.FieldByName ( 'secondname' ).AsString; item.Patronymic := dataSet.FieldByName ( 'thirdname' ).AsString; item.CardNumber := dataSet.FieldByName ( 'cardnumber' ).AsString; list.Add ( item ); dataSet.Next (); end; 

The Clear () method does not free memory, so every time I populate my list, Windows Task Manager uses the use of my application: (

+5
source share
1 answer

Your list does not release TVisitor instances.

Create looks like this:

 TCollections.CreateList<TVisitor>(True); 
+7
source

All Articles