Memory Error
I use Delphi 2005 update 3, Report Builder 9.03 and FastMM 4.42 (Fast
Memory Manager).
With this code :
------------------------------------
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, StdCtrls;
type
TForm4 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses
ppReport,
ppEndUsr,
raCodMod,
raIde,
daDatMan;
{$R *.dfm}
procedure TForm4.Button1Click(Sender: TObject);
var
oRpt: TppReport;
begin
inherited;
oRpt := TppReport.Create(nil);
with TppDesigner.Create(nil) do
begin
Report := oRpt;
ShowModal;
Free;
end;
oRpt.Free;
end;
end.
------------------------------------------
If I click the button1, on the designer click the Data TabSheet, close
designer et re-click the button1, FastMM show the message "FastMM has
detected an error during a GetMem operation. FastMM detected that a
block has been modified after being freed".
I add "DataSettings := nil;" in ppDsgner.pas at line 1775 in "destructor
TppDesignerWindow.Destroy;"
My question is : It's ok if I add this line or if a patch is available
for resolve the memory problem ?
Thanks in advance!!
Marius
Memory Manager).
With this code :
------------------------------------
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, StdCtrls;
type
TForm4 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses
ppReport,
ppEndUsr,
raCodMod,
raIde,
daDatMan;
{$R *.dfm}
procedure TForm4.Button1Click(Sender: TObject);
var
oRpt: TppReport;
begin
inherited;
oRpt := TppReport.Create(nil);
with TppDesigner.Create(nil) do
begin
Report := oRpt;
ShowModal;
Free;
end;
oRpt.Free;
end;
end.
------------------------------------------
If I click the button1, on the designer click the Data TabSheet, close
designer et re-click the button1, FastMM show the message "FastMM has
detected an error during a GetMem operation. FastMM detected that a
block has been modified after being freed".
I add "DataSettings := nil;" in ppDsgner.pas at line 1775 in "destructor
TppDesignerWindow.Destroy;"
My question is : It's ok if I add this line or if a patch is available
for resolve the memory problem ?
Thanks in advance!!
Marius
This discussion has been closed.
Comments
I looked at the source code and yes you can add that line. Its not a memory
leak, but it is more correct to set the reference to nil. (We can add that
code to our code base for the next release.)
As a side note, the form/datamodule should always be the Owner for the
TppReport and TppDesigner objects. In you example code, pass Self to the
constructor rather than nil.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com