From 23ccc8327be4926fc01932af0d5442e6f5325ce3 Mon Sep 17 00:00:00 2001 From: Damon Lu <59256766+WhatDamon@users.noreply.github.com> Date: Sat, 30 Nov 2024 20:00:12 +0800 Subject: [PATCH] chore: More `GC.Collect();` --- WndMain.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/WndMain.cs b/WndMain.cs index a3484fd..eda1707 100644 --- a/WndMain.cs +++ b/WndMain.cs @@ -45,6 +45,10 @@ public WndMain() // 加载摄像头设备 private void CameraDevicesLoad() { + // 顺便释放点垃圾 + GC.Collect(); + + // 清空下拉列表 cameraComboBox.Items.Clear(); bool _cameraFound = false; foreach (var i in FindCamera.EnumDevices.Devices) @@ -79,7 +83,7 @@ private void LoadFaceCascade(string fileName) { faceCascade.Dispose(); faceCascade = null; - System.GC.Collect(); + GC.Collect(); } string xmlPath = Path.Combine(Application.StartupPath, "cascades/", fileName); @@ -317,6 +321,9 @@ private void machineStatusTimer_Tick(object sender, EventArgs e) // 关于 private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { + // 顺便垃圾回收下 + GC.Collect(); + TaskDialogPage page = new TaskDialogPage() { Text = "这是一个启发于某沃基于人脸识别随机抽人的玩具\n" +