DelphiTools – One of the memory hogs when you have object trees or graphs can be good old TList and its many variants (TObjectList, TList<T>, etc.). This is especially an issue when you have thousandths of lists that typically hold very few items, or are empty. In the DWS expression tree f.i. there are quickly thousandths of such lists, for local symbol tables, parameter lists, etc. How much does a TList cost in terms of memory? A TList holding a single item already costs you: 4 bytes for the field in the owner object 20 bytes for the TList instance 8 hidden bytes: Monitor + VMT pointer 12 field ...
Visits by Source
Users who voted for this posting