The constructor of TFPGObjectList is defined as follows:
public constructor TFPGObjectList.Create(FreeObjects: Boolean = True);
Documentation says:
"If FreeObjects is true, then the list owns the objects. Freeing or clearing the list will remove all objects from memory by calling the destructor. Deleting or removing an item from the list will also dispose of the element."
(
https://www.freepascal.org/docs-html/current/rtl/fgl/tfpgobjectlist.create.html)
If you enable heap trace in your code, as follows:
program project1;
{$DEFINE debug}
uses
fgl,sysutils;
type
Expression = class(TObject)
public
value: integer;
constructor Create(v: integer);
end;
TMyList = specialize TFPGObjectList<Expression>;
var
list: TMyList;
i: integer;
e: Expression;
constructor Expression.Create(v: integer);
begin
self.value := v;
end;
begin
{$IFDEF DEBUG}
if FileExists('heap.trc') then
DeleteFile('heap.trc');
SetHeapTraceOutput('heap.trc');
{$ENDIF DEBUG}
list := TMyList.Create;
for i := 1 to 10 do
begin
list.Add(Expression.Create(i));
end;
for e in list do
begin
writeln(e.value);
end;
list.Free;
{ Expression objects still on the heap? }
readln;
end.
After program execution you have this trace (heap.trc file):
Heap dump by heaptrc unit
64 memory blocks allocated : 2242/2432
64 memory blocks freed : 2242/2432
0 unfreed memory blocks : 0
True heap size : 196608 (160 used in System startup)
True free heap : 196448
So I think that It is not necessary to delete the items in the list. In fact, if you do, a run time error occurs (SIGSEGV).