Code: Select all
program crlabconnection;
{$APPTYPE CONSOLE}
{%DelphiDotNetAssemblyCompiler 'c:\program files\corelab\oradirect.net\CoreLab.Oracle.dll'}
uses
SysUtils,
CoreLab.Oracle;
var
Conn:OracleConnection;
I:Integer;
begin
Conn:=OracleConnection.Create('User Id=chtpz;Password=w;Data Source=garnet;pooling=false');
for I:=0 to 100000 do
begin
try
Conn.Open;
WriteLn('I=',I);
finally
Conn.Close;
end;
GC.Collect;
GC.WaitForPendingFinalizers;
end;
Conn.Dispose;
WriteLn('Press Enter key...');
ReadLn;
end.
Delphi's event log contain following lines:
Module Load: mscorlib. No Debug Info. Base Address: $79780000. Process crlabconnection.exe (2688)
Thread Start: Thread ID: 3872. Process crlabconnection.exe (2688)
Process Start: Attached/Spawned Process 0xA80. Process crlabconnection.exe (2688)
Module Load: crlabconnection. No Debug Info. Base Address: $00400000. Process crlabconnection.exe (2688)
Module Load: corelab.oracle. No Debug Info. Base Address: $11000000. Process crlabconnection.exe (2688)
Module Load: system. No Debug Info. Base Address: $7B0A0000. Process crlabconnection.exe (2688)
Module Load: system.data. No Debug Info. Base Address: $7A6E0000. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $8ECD5633. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $AB68D52E. Process crlabconnection.exe (2688)
Thread Start: Thread ID: 2900. Process crlabconnection.exe (2688)
Process Start: Attached/Spawned Process 0xA80. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $A3B4AB4F. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $F6A6CD0C. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $339E2C2F. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $65CE1A9A. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $46864EE4. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $B9AA6FAE. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $234FDAC6. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $521573BE. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $13D1EF86. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $2761095F. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $97AE3A57. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $78639270. Process crlabconnection.exe (2688)
[...]
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $941A634E. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $1A4F2792. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $668DAD59. Process crlabconnection.exe (2688)
Module Load: Unknown or Dynamic Module. No Debug Info. Base Address: $48B2A312. Process crlabconnection.exe (2688)
It seems this "Module load" happen on each iteration.
I'm thought it is way how GC works and wrote another simple program:
Code: Select all
program gcdemo;
{$APPTYPE CONSOLE}
{%DelphiDotNetAssemblyCompiler 'c:\program files\common files\borland shared\bds\shared assemblies\3.0\Borland.Vcl.dll'}
uses
SysUtils,
Classes,
Math;
var
L:TStrings;
I,J:Integer;
begin
for I:=0 to 1000000 do
begin
L:=TStringList.Create;
try
for J:=0 to 1000 do
begin
L.Append(StringOfChar(Chr(Random(255)),RandomRange(10,2000)))
end;
finally
L.Free;
end;
end;
WriteLn('Press Enter...');
ReadLn;
end.