TextBox存在内存泄露的可能
背景
-WPF桌面程序中,增加了一个TextBox控件,用于显示输出的日志信息,日志信息量很大(具体数值未统计)
XAML 代码
<TextBox Text="{Binding Message}" TextWrapping="Wrap" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextChanged="TextBox_TextChanged" />
CS 代码
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (!(sender is TextBox)) return;