Created
November 13, 2021 15:07
-
-
Save bero/6cf25295d7bf35b50a9a88cc6b632843 to your computer and use it in GitHub Desktop.
Example of how to handle memory in a list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit Unit3; | |
interface | |
procedure TestMemory; | |
implementation | |
uses | |
Classes, | |
Contnrs, | |
SysUtils; | |
procedure TestMemory; | |
var | |
i, t, Size, NTests: Integer; | |
list: TObjectList; | |
begin | |
NTests := 5; | |
for t := 0 to NTests do | |
begin | |
Size := 50000; | |
list := TObjectList.Create; | |
try | |
for i := 0 to Size do | |
list.Add(TList.Create); // might be any class instantiation | |
finally | |
list.Free; | |
end; | |
end; | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment