버튼을 클릭 할 때 180도 회전하는 6 면체 ("상자")가있는 매우 간단한 초보자 앱을 작성했습니다. 다음 클릭시 다시 회전합니다. 모든 회전은 90MB를 더 차지하며 앱을 종료 할 때까지 기다리지 않습니다. 이 상자는 XAML에 정의되어 있습니다. Storyboard
, DoubleAnimation
및 PropertyPath
등은 모두 생성자에서 한 번만 만들어집니다. 버튼 코드는 다음과 같습니다.WPF의 메모리 누수
private void button_Storyboard1_Click(object sender, RoutedEventArgs e)
{
GC.Collect();
if (_bFront)
{
_myDoubleAnimation.From = 0;
_myDoubleAnimation.To = 180;
_bFront = false;
}
else
{
_myDoubleAnimation.From = 180;
_myDoubleAnimation.To = 0;
_bFront = true;
}
_myDoubleAnimation.Duration = _Duration;
Storyboard.SetTargetName(_myDoubleAnimation, "rotate_me");
Storyboard.SetTargetProperty(_myDoubleAnimation, _PropP);
_sb.Children.Add(_myDoubleAnimation);
_sb.Begin(this.viewport3D1);
}
몇 회전 후 메모리가 부족합니다. 무슨 일이야?
제발 내가 gfx 카드를 알려주시겠습니까? –