-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemoryLeak in net 462 #386
Comments
I don't know, but didn't avalonedit have a undo stack? maybe this keeps all in memory? and if there is one (wich i don't know atm), isn't there an api to clear? |
However, even use The only way is that to set |
set Sample Code: private async void TryWithSetNull(object sender, RoutedEventArgs e)
{
await Task.Run(async () => {
for (int i = 0; i < 100; i++) {
App.Current.Dispatcher.Invoke(() => {
editor.Text = SampleText;
});
await Task.Delay(50);
App.Current.Dispatcher.Invoke(() => {
editor.Clear();
editor.ClearUndo(); // clear undo stack
editorGrid.Children.Clear();
editor = null;
editor = CreateTextEditor();
});
}
});
button.IsEnabled = true;
}
public TextEditor CreateTextEditor()
{
editor = new TextEditor();
editor.BorderBrush = Brushes.Blue;
editor.BorderThickness = new Thickness(1);
editorGrid.Children.Add(editor);
return editor;
}
// in TextEditor.cs
public void ClearUndo()
{
TextDocument document = this.Document;
document.UndoStack.ClearAll();
}
|
There seems to be a memory leak
This is my step:
However, the text has been emptied at last, and the memory is still not recycled
Before
After 10 minute
The text was updated successfully, but these errors were encountered: