解决方法
TStringList的
OwnsObjects
属性应设置为True,以便列表在销毁时释放其对象.这可以通过调用
constructor overload that receives the OwnsObjects
parameter或通过在创建后显式设置属性来实现.最好将OwnsObjects设置为对象构造的一部分.
documentation描述了这样的属性:
The OwnsObjects property specifies whether the string list owns the stored objects or not. If the OwnsObjects property is set to True,then the Destroy destructor will free up the memory allocated for those objects.