似乎我有内存泄漏,因为我发现这个过程每分钟都在变大。
请协助: - )
while (true)
{
using (Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
{
using (Graphics graphics = Graphics.FromImage(bitmap))
{
try
{
graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
bitmap.Save(@path + System.Environment.MachineName + ".jpg", ImageFormat.Jpeg);
}
catch (Exception) // Handle file save problems
{
if (File.Exists("path.save"))
{
File.Delete("path.save");
}
}
}
}
Thread.Sleep(15000);
}
答案 0 :(得分:0)
运行24小时后,我看到内存列在几个小时后就稳定了,正如大多数人说的那样,我再也不用担心这个专栏:-) 感谢您的提示,我现在了解更多!