I'm having problems with memory leakage using D3 and Interbase. It seems
fairly easy to duplicate... here are the steps (complete with source for the
lazy-folk) :
Steps for reproducing db memory leakage
1. Create a database with WISQL - c:/temp/testdb.gdb (SYSDBA, "masterkey")
2. Run SQL script through WISQL :
CONNECT "c:\temp\testdb.gdb" USER "SYSDBA" PASSWORD "masterkey";
CREATE TABLE Table1 (
BearNo INTEGER,
BearName CHAR(16)
);
SET TERM !! ;
CREATE PROCEDURE AddBear (BearNo INTEGER, BearName CHAR(16))
AS BEGIN
INSERT INTO TABLE1 (BearNo, BearName)
VALUES (:BearNo, :BearName);
EXIT;
END !!
CREATE PROCEDURE KillBear (BearNo INTEGER)
AS BEGIN
DELETE FROM TABLE1 WHERE BearNo = :BearNo;
EXIT;
END !!
3. Create a new BDE Interbase Alias : TempDb. Only field changed in alias
config is "SERVER NAME" to "c:\temp\testdb.gdb"
4. Create a new Delphi 3.0 application. Two stored procedures, connected
through a database component. Both procedures called by number, all else is
default (other than database name or stored procedure name).
5. Add Two buttons to the main form. Here is the body of the main form from
the "var" line down :
var
Form1: TForm1;
Bears : array[1..10] of string =
('Smokey', 'Yogi', 'Care', 'Teddy', 'Paddington',
'Hooligan', 'Burglar', 'Crook', 'Deadbeat', 'Derelect');
Done : Boolean;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var i : Integer;
begin
Done := False;
while not Done do begin
for i := 1 to 10 do begin
spAdd.ParamByName('BearNo').AsInteger := i;
spAdd.ParamByName('BearName').AsString := Bears[i];
spAdd.ExecProc;
end;
for i := 1 to 10 do begin
spKill.ParamByName('BearNo').AsInteger := i;
spKill.ExecProc;
end;
Application.ProcessMessages;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Done := True;
end;
6. Application compiles are runs with warnings/errors. After pressing
Button1, application will show significant memory gain almost immediately.
Running queries through SQL Explorer will verify that the application is
successfully posting records to the table.
7. Stop program. Comment out the sp*.ExecProc lines and re-run the
program. The application will show no memory gain after Button1 is pressed.
Could someone verify this? It would seem to be a rather large problem
for database applications that run for extended periods of time...
-D