Page 1 of 1

ODAC v6.70 TOraSession:Connect/Disconnect causes memory leak

Posted: Thu 06 Nov 2008 09:56
by Vitaliy_S
Hi,

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  OraSession1:= TOraSession.Create(nil);
  OraSession1.Username:='sys';
  OraSession1.Password:='xxxxxxxxxxx';
  OraSession1.Server:='192.168.1.8:1521:TESTDB';
  OraSession1.ConnectMode:=cmSysDBA;
  OraSession1.Options.Direct:=true;
    while True do
    begin
      OraSession1.Connect;
      OraSession1.Disconnect;
    end;
end;
TOraSession Connect/Disconnect causes memory leak, if running Form1 minimize - memory free, which is visible in taskmanager.
I've test it with ODAC v6.50(Trial) and v6.70(Trial), Delphi 2007. Oracle server 10.2.0.4, oracle client not installed.

P.S. Sorry for my bad English.

Posted: Fri 07 Nov 2008 08:37
by Plash
We could not reproduce the problem. Please send to odac*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.

Posted: Fri 07 Nov 2008 10:05
by Vitaliy_S
We could not reproduce the problem ?
Ok, simple example:

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Ora, DB, OraClasses, DBAccess;

type
  TForm1 = class(TForm)
    Button1: TButton;
    OraSession1: TOraSession;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer;
begin
  OraSession1.Username:='sys';
  OraSession1.Password:='xxxxxxxx';
  OraSession1.Server:='192.168.1.8:1522:TESTDB';
  OraSession1.ConnectMode:=cmSysDBA;
  OraSession1.Options.Direct:=true;
    for i:=1 to 1000 do
    begin
      OraSession1.Connect;
      OraSession1.Disconnect;
    end;
end;
end.
Before procedure executing memory usage - 4436 kb, after procedure executing - 17057 kb (look the windows tasks manager).
1000 operations connect/disconnect - use 12 616kb of the RAM. Why?

Posted: Mon 10 Nov 2008 09:00
by Plash
Please do the following test to detect if a memory leak occurs:
1. Replace the loop in your program with the following:

Code: Select all

    while True do
    begin
      OraSession1.Connect;
      OraSession1.Disconnect;
    end;
2. Run the application; open Task Manager; go to the Processes tab, and find your application in the list. See if the value in the Mem Usage column increases or it remains on the same level.

Posted: Mon 10 Nov 2008 09:22
by Vitaliy_S
Memory usage increases at each operation Connect/Disconnect by 4-12 kb. :(

Posted: Wed 03 Dec 2008 08:39
by Plash
If you install AQTime or similar program to detect memory leaks, we can send you a test application compiled with debug information. Then you can run this application in AQTime to see the place where the memory leak occurs.

Posted: Thu 04 Dec 2008 10:44
by jfudickar
Hi Oleg,

i have AQTime installed and you can send me the project also.

So i can verify it also, if needed.

Greetings
Jens

Posted: Mon 08 Dec 2008 10:16
by Plash
To jfudicar:

You need this test project and AQTime only if you can reproduce the memory leak. You can see if the memory leak occurs using Task Manager.