Skip to content

Commit

Permalink
chore: More GC.Collect();
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatDamon committed Nov 30, 2024
1 parent 648d12d commit 23ccc83
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion WndMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public WndMain()
// 加载摄像头设备
private void CameraDevicesLoad()
{
// 顺便释放点垃圾
GC.Collect();

// 清空下拉列表
cameraComboBox.Items.Clear();
bool _cameraFound = false;
foreach (var i in FindCamera.EnumDevices.Devices)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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" +
Expand Down

0 comments on commit 23ccc83

Please # to comment.