EControl Ltd. Forum Index EControl Ltd.
VCL libraries and software support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Out of Memory Error

 
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor
View previous topic :: View next topic  
Author Message
mstaszew



Joined: 21 Jul 2006
Posts: 67
Location: North Carolina, USA

PostPosted: Tue Jul 25, 2006 2:16 pm    Post subject: Out of Memory Error Reply with quote

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
View user's profile Send private message
jfudickar



Joined: 12 Jun 2006
Posts: 38
Location: Eschborn, Germany

PostPosted: Tue Jul 25, 2006 5:31 pm    Post subject: Reply with quote

Add more memory to your computer Question Very Happy
Back to top
View user's profile Send private message Visit poster's website
mstaszew



Joined: 21 Jul 2006
Posts: 67
Location: North Carolina, USA

PostPosted: Tue Jul 25, 2006 5:32 pm    Post subject: Reply with quote

I have 2 gigs!!!!

...but, I'll tell the boss man that I need more memory anyway. Laughing
Back to top
View user's profile Send private message
econtrol
Site Admin


Joined: 09 Jun 2006
Posts: 202

PostPosted: Wed Jul 26, 2006 6:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    EControl Ltd. Forum Index -> EControl Syntax Editor All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group