Clear a TList or a TObjectList

后端 未结 5 1435
故里飘歌
故里飘歌 2021-02-19 05:33

I\'m a bit puzzled of what to use for storing objects in a list. Until now I have used TList and freed each item in a loop. Then I discovered TObjectList

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-19 06:25

    Read what the documentation is saying more carefully:

    Clear also frees the memory used to store the Items array

    Only the memory for the array itself is freed, not the memory used by individual elements inside the array.

提交回复
热议问题