TOraSQL - memory leak in Direct mode when param type is not defined

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

TOraSQL - memory leak in Direct mode when param type is not defined

Post by pcz » Mon 20 Jun 2016 11:28

Hello

I've found strange memory leak in TOraSQL class

It happens when:
  • Using Direct connection mode
    Type of parameter is not defined
Image

Delphi XE 7 Pro
ODAC 9.7.24 Pro



Sources:

Code: Select all

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, DBAccess, Ora, OraCall, Data.DB, OdacVcl;

type
  TForm1 = class(TForm)
    OraSession1: TOraSession;
    SQL1: TOraSQL;
    ConnectDialog1: TConnectDialog;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  OraSession1.Connect;
  SQL1.Execute;
end;

end.

Code: Select all

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 136
  ClientWidth = 241
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object OraSession1: TOraSession
    Options.Direct = True
    Username = 'test'
    Server = '192.168.0.177:1522:TEST'
    ConnectDialog = ConnectDialog1
    Left = 32
    Top = 16
    EncryptedPassword = '8CFF92FF8BFF'
  end
  object SQL1: TOraSQL
    SQL.Strings = (
      'declare'
      '  v_COUNT integer;'
      '  v_RESULT boolean;'
      'begin'
      '  select count(1)'
      '  into v_COUNT'
      '  from inw_rozl_mag rm'
      '  where rm.status = '#39'W TOKU'#39';'
      ''
      '  v_RESULT := v_COUNT = 0;'
      '  :RESULT := sys.DIUTIL.BOOL_TO_INT(v_RESULT);'
      'end;')
    Left = 136
    Top = 16
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'RESULT'
        Value = nil
      end>
  end
  object ConnectDialog1: TConnectDialog
    Caption = 'Connect'
    ConnectButton = 'Connect'
    CancelButton = 'Cancel'
    Server.Caption = 'Server'
    Server.Visible = True
    Server.Order = 1
    UserName.Caption = 'User Name'
    UserName.Visible = True
    UserName.Order = 2
    Password.Caption = 'Password'
    Password.Visible = True
    Password.Order = 3
    Home.Caption = 'Home Name'
    Home.Visible = False
    Home.Order = 0
    Direct.Caption = 'Direct'
    Direct.Visible = False
    Direct.Order = 6
    Schema.Caption = 'Schema'
    Schema.Visible = False
    Schema.Order = 4
    Role.Caption = 'Connect Mode'
    Role.Visible = False
    Role.Order = 5
    Left = 32
    Top = 80
  end
end

Regards
P.C.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraSQL - memory leak in Direct mode when param type is not defined

Post by AlexP » Mon 20 Jun 2016 13:57

Hello,

Thank you for the sample. We have reproduce the issue and will investigate the reasons for such behavior.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: TOraSQL - memory leak in Direct mode when param type is not defined

Post by pcz » Tue 28 Jun 2016 06:42

Problem stil happens in 9.7.25

This thread:
viewtopic.php?f=5&t=33844
can be related with current too

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraSQL - memory leak in Direct mode when param type is not defined

Post by AlexP » Thu 30 Jun 2016 08:43

We have reproduced and fixed the issue. This fix will be included in the next version.

pcz
Posts: 81
Joined: Tue 04 Aug 2015 12:53

Re: TOraSQL - memory leak in Direct mode when param type is not defined

Post by pcz » Thu 30 Jun 2016 10:13

AlexP wrote:We have reproduced and fixed the issue. This fix will be included in the next version.
Ok, thanks :)

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: TOraSQL - memory leak in Direct mode when param type is not defined

Post by AlexP » Thu 30 Jun 2016 10:41

You are welcome. Feel free to contact us if you have any further questions.

Post Reply