Access Violation and memory leak while app finalization

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Traptak
Posts: 26
Joined: Fri 29 Jun 2007 07:15

Access Violation and memory leak while app finalization

Post by Traptak » Thu 02 Apr 2015 16:20

Hello,

I found a bug in ODAC. I'm using Delphi XE4 and ODAC 9.3.10. I wrote small apps which could demonstrate problem:

Dfm file:

Code: Select all

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 242
  ClientWidth = 527
  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 orsn1: TOraSession
    Username = 'system'
    Server = 'xe'
    ConnectDialog = cnctdlg1
    Left = 256
    Top = 128
  end
  object cnctdlg1: TConnectDialog
    Caption = 'Rejestracja'
    ConnectButton = 'Ok'
    CancelButton = 'Anuluj'
    Server.Caption = 'Opis hosta'
    Server.Visible = True
    Server.Order = 1
    UserName.Caption = 'U'#380'ytkownik'
    UserName.Visible = True
    UserName.Order = 2
    Password.Caption = 'Has'#322'o'
    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
    LabelSet = lsCustom
    Left = 160
    Top = 120
  end
  object q1: TOraQuery
    Session = orsn1
    SQL.Strings = (
      'select * from dual')
    Left = 344
    Top = 136
  end
end
Pas file:

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, OdacVcl, OraCall, Data.DB, Ora, MemDS;

type
  TForm1 = class(TForm)
    orsn1: TOraSession;
    cnctdlg1: TConnectDialog;
    q1: TOraQuery;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  list: TStringList;
begin
  orsn1.Connect;
  list := TStringList.Create;
  q1.GetFieldNames(list);
  Caption := list.Text;
  list.Free;
end;

end.
Dpr file:

Code: Select all

program Project1;

uses
  FastMM4,
  Vcl.Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
Please compile apps and open connection to the existing database and then close the application. After closing an error is shown:
--------------------------------2015/4/2 18:15:43--------------------------------
This application has leaked memory. The small block leaks are (excluding expected leaks registered by pointer):

1 - 20 bytes: TDAObjectList x 2, UnicodeString x 1
21 - 100 bytes: TOracleHomes x 1, EAccessViolation x 3, TMTSAPI x 1, TCriticalSection x 7, TOracleHome x 1, TOCISvcCtx x 1, UnicodeString x 1, Unknown x 2
101 - 196 bytes: TOCI7API x 1, UnicodeString x 6
789 - 948 bytes: TOCI8API x 1

Note: Memory leak detail is logged to a text file in the same folder as this application. To disable this memory leak check, undefine "EnableMemoryLeakReporting".
best regards
Adam Siwoń

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

Re: Access Violation and memory leak while app finalization

Post by AlexP » Fri 03 Apr 2015 07:50

Hello,

Thank you for the sample. We have reproduced the described case and will investigate the reason for such behavior. We will inform you as soon as we have any results.

Post Reply