Thank you for your quick response, but it didn't work as expected.
I called explicitly the Clear and ClearUndo, but the memory leak still remains.
I made a example application, in Delphi5, with only one form.
In this form, I put a TRichViewEdit, a TRVStyle and tow buttons.
The first button is the "fill" button, and it just fills the RichViewEdit with a lot of text, just selecting all text, copying it to clipboard, and pasting it tow times to duplicate it like I made manually.
Its code is the following:
Code: Select all
procedure TExampleMainForm.ButtonFillClick(Sender: TObject);
const
inDuplicationCount = 11;
var
inIndex: Integer;
stText: String;
pcCurrent: PChar;
begin
ButtonFill .Enabled := False;
ButtonClear.Enabled := False;
try
// Create a 10Kb text (randomic uppercase letters).
SetLength(stText, 10240);
pcCurrent := PChar(stText);
for inIndex := 1 to Length(stText) do
begin
pcCurrent^ := Chr(Random(26) + 65); // A to Z.
Inc(pcCurrent);
end; // for
// Clear the current text.
RichViewEditMain.Clear;
// Put the new text.
RichViewEditMain.InsertTextW(stText + #13);
// Free the internal copy of the original text.
stText := '';
// Text dupplication loop.
for inIndex := 1 to inDuplicationCount do
begin
// Show the current progress in the button caption.
ButtonFill.Caption := IntToStr(inIndex) + '/' +
IntToStr(inDuplicationCount) + ' (' +
IntToStr((inIndex * 100) div inDuplicationCount) + '%)';
// Select the entire current text.
RichViewEditMain.SelectAll;
// Copy it to clipboard as RTF text.
RichViewEditMain.CopyRTF;
// Past it two times to duplicate it.
RichViewEditMain.Paste;
RichViewEditMain.Paste;
end; // for
finally
ButtonFill .Caption := '&Fill';
ButtonFill .Enabled := True;
ButtonClear.Enabled := True;
end;// try-finally
end;
The second button is the "clear" button, and this code is the following:
Code: Select all
procedure TExampleMainForm.ButtonClearClick(Sender: TObject);
begin
RichViewEditMain.Clear;
RichViewEditMain.ClearUndo;
RichViewEditMain.RVData.Refresh;
end;
When this application is running, I click in the "Fill" button, and the memory usage of the application comes to 73Mb (average).
When I click the "clear" button, the application memory usage comes to 17Mb, not the initial memory usage value.
Unhappy, changing the value of the UndoLimit had no any effect.
I'm using the TRichViewEdit version 1.9.15.1 for Delphi 5.
Please, help me with this problem.