Hi
I have a dynamic link library written in Delphi 2006 that has forms.pas in its use case.
If I load the dll and then immediately unload it into a for loop, say 10,000 times, the memory goes up slowly. However, if I take Forms.pas from the uses dll clause, the problem disappears.
The code is very simple.
Here is my code for the dll:
library Project1;
uses
Forms;
begin
end.
Here is my code for the calling application:
procedure TForm1.Button1Click(Sender: TObject);
var
t_ImportHandle: LongInt;
t_Index: Integer;
begin
for t_Index := 0 to 10000 - 1 do
begin
t_ImportHandle := LoadLibrary('Project1.dll');
FreeLibrary(t_ImportHandle);
end;
end;
Can anyone else repeat this or find out the reason and how to fix it?
source
share