WPF 内存释放

mac2022-06-30  80

在WPF 项目中引用到Transitionals 实现图片转场特效,发现每次图片转场内存都会增加,在每次转场后进行内存压缩

记录 解决方案如下:

GC.Collect(); GC.WaitForPendingFinalizers(); if (Environment.OSVersion.Platform == PlatformID.Win32NT) {   SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1); } [DllImport("kernel32.dll")] private static extern bool SetProcessWorkingSetSize(IntPtr proc, int min, int max);

 

转载于:https://www.cnblogs.com/kennyqiu/p/8296436.html

相关资源:释放WPF应用程序的内存
最新回复(0)