View previous topic :: View next topic |
Author |
Message |
mstaszew
Joined: 21 Jul 2006 Posts: 67 Location: North Carolina, USA
|
Posted: Tue Jul 25, 2006 2:16 pm Post subject: Out of Memory Error |
|
|
Out of memory error is generated when using the AppendText routine. I make it through approximately 2600 iterations of the for loop below before it crashes.
Code: | procedure TForm1.Button1Click(Sender: TObject);
const
TEST_TEXT =
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|'+
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|'+
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|'+
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|'+
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|'+
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|'+
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|'+
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|'+
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|'+
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|';
var
I: Integer;
begin
TestMemo.BeginUpdate;
try
for I := 1 to SpinEdit1.Value do
TestMemo.Lines.Append(TEST_TEXT);
finally
TestMemo.EndUpdate;
end;
end; |
Thanks. |
|
Back to top |
|
|
jfudickar
Joined: 12 Jun 2006 Posts: 38 Location: Eschborn, Germany
|
Posted: Tue Jul 25, 2006 5:31 pm Post subject: |
|
|
Add more memory to your computer |
|
Back to top |
|
|
mstaszew
Joined: 21 Jul 2006 Posts: 67 Location: North Carolina, USA
|
Posted: Tue Jul 25, 2006 5:32 pm Post subject: |
|
|
I have 2 gigs!!!!
...but, I'll tell the boss man that I need more memory anyway. |
|
Back to top |
|
|
econtrol Site Admin
Joined: 09 Jun 2006 Posts: 202
|
Posted: Wed Jul 26, 2006 6:41 pm Post subject: |
|
|
Thank you for bug report.
It was really a generic bug.
Fixing (ecSyntMemo.pas)
Code: | procedure TCustomSyntaxMemo.UpdateLineInfosAfterEdit(EditPos: TPoint;
LineChange: integer);
var i, Line, tmp: integer;
// Info: TLineInfo;
ReCalcCount: Boolean;
begin
Line := EditPos.Y;
ReCalcCount := LineChange <> 0;
if LineChange < 0 then
begin
if EditPos.X = 0 then tmp := Line else tmp:= Line + 1;
for i := tmp - LineChange - 1 downto tmp do
if i < FLinesDesc.Count then
FLinesDesc.Delete(i);
end else
if LineChange > 0 then
for i := 1 to LineChange do
begin
// Info := TLineInfo.Create;
// Info.FInvalid := True;
// Info.State := lsNew;
if Line + i < FLinesDesc.Count then FLinesDesc.Insert(Line + i, nil{Info})
else FLinesDesc.Add(nil {Info});
end;
if (FLinesDesc.Count > Line) and (FLinesDesc[Line] <> nil) then
with TLineInfo(FLinesDesc[Line]) do
begin
// ReCalcCount := ReCalcCount or (LineCount > 1);
Dec(Self.FLineCount, LineCount - 1);
FInvalid := True;
Clear;
end;
ResetLineHeights(False, Line);
// GetLineInfo(Line).State := lsModified;
Inc(FLineCount, LineChange);
// if ReCalcCount then
// CalcLineCount;
end; |
This fix is temporary solution (it disables line state monitoring)
In new update (v2.25) there will be complete solution with line state monitoring.
Michael. |
|
Back to top |
|
|
|