I wonder if there may be a memory leak problem in TOraSession?
I checked everything regarding to programming issues. but unable to find out anything produces memory leaks. I have developed the following test application, and it produces memory leak. If we comment OraSession1.Connect; line, there is no memory leak..
When the following thread function started by other routine periodically application's memory usage increases.
Code: Select all
function testThread(RMessage: Pointer): dword;
var
OraSession1 : TOraSession;
begin
OraSession1 := TOraSession.Create(nil);
try
OraSession1.ConnectPrompt := False;
OraSession1.AutoCommit := False;
OraSession1.ThreadSafety := True;
OraSession1.Username := 'dbuser';
OraSession1.Password := 'dbuserpassword';
OraSession1.Server := 'dbinstancename';
OraSession1.Connect;
try
// do something...
finally
OraSession1.Disconnect;
end;
finally
OraSession1.Free;
end;
Result := 0;
end;
Code: Select all
procedure TForm1.Timer3Timer(Sender: TObject);
var
i : integer;
vThreadid : cardinal;
vthreadHandleArray: array[1..MAX_THREADS] of THandle;
begin
for i := 1 to MAX_THREADS do
vthreadHandleArray[i] := BeginThread(nil,
0, @testThread,
nil,
0,
vThreadId);
WaitForMultipleObjects(MAX_THREADS, @vthreadHandleArray, TRUE, INFINITE);
for i := 1 to MAX_THREADS do
CloseHandle(vthreadHandleArray[i]);
end;