Page 1 of 1

Memory leak with CLOB field (Delphi XE, ODAC 8.2)

Posted: Tue 03 Jul 2012 10:55
by balazs miereisz
Hi Team,

We use FastMM4 unit to explore the memory leaks in our application. After we upgrade to the latest ODAC (8.2) package we are experiencing some memory leaks. With ODAC 8.1 we haven't got this problem.

This is how we can produce some memory leaks with CLOB field:

Oracle code:

Code: Select all

CREATE TABLE T_CLOBTEST (
  ID NUMBER(9) PRIMARY KEY,
  CLOBDATA CLOB
);

INSERT INTO T_CLOBTEST(ID) VALUES (1);

COMMIT;
Delphi XE code draft:

OraQuery1.SQL:

SELECT ID, CLOBDATA
FROM T_CLOBTEST
WHERE ID = :iID

OraQuery1.SQLInsert:

INSERT INTO T_CLOBTEST (ID, CLOBDATA)
VALUES (:ID, EMPTY_CLOB())
RETURNING CLOBDATA INTO :CLOBDATA

Code: Select all

unit Unit1;

interface

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

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

var
  Form1: TForm1;

implementation

uses FastMM4;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  OraQuery1.Close;
  OraQuery1.ParamByName('iID').AsInteger := 1;
  OraQuery1.Open;

  OraQuery1.Close;
  OraQuery1.ParamByName('iID').AsInteger := -1;
  OraQuery1.Open;

  OraQuery1.Append;
  OraQuery1.FieldByName('ID').AsInteger := 2;
  OraQuery1.FieldByName('CLOBDATA').AsString := 'TEST';
  OraQuery1.Post;
  OraQuery1.Close;
end;

end.
After pressing Button1 and closing the sample application FastMM reports some memory leaks in objects TCompressedBlobData and TOraLob.

Best regards,
Balazs Miereisz

Re: Memory leak with CLOB field (Delphi XE, ODAC 8.2)

Posted: Thu 05 Jul 2012 11:35
by AlexP
hello,

We could reproduce this problem only on a "clean" FastMM, when the FullDebugMode option is enabled, no memory leak is detected. As well as it is not detected when using the EurekaLog utility. We will investigate this problem and let you know the results.

Re: Memory leak with CLOB field (Delphi XE, ODAC 8.2)

Posted: Thu 07 Feb 2013 11:32
by a-s-z
Hi,
AlexP wrote:hello,

We could reproduce this problem only on a "clean" FastMM, when the FullDebugMode option is enabled, no memory leak is detected. As well as it is not detected when using the EurekaLog utility. We will investigate this problem and let you know the results.
We have this problem too and are using Odac 8.6.11.

After reading this post and topic http://forums.devart.com/viewtopic.php? ... 04&p=83576, I have checked the implementation of FastMM4.
FastMM will fill memory blocks with a predefined pattern in FullDebugMode, so the problem of uninitialized/reused items will not appear with standard FastMM. If you change FastMM4.DebugFillByte to $DD, problem will be visible in FullDebugMode too. CatchUseOfFreedInterfaces must be disabled for this to work.

Best Regards,
Andre

Re: Memory leak with CLOB field (Delphi XE, ODAC 8.2)

Posted: Mon 11 Feb 2013 12:20
by AlexP
Hello,

We have fixed the problem. The new version with this fix will be released this week.