调用清除方法时同时调用GC

增加版本号:2.20.24.1
master
lhiven 1 year ago
parent 5e4eb1ea58
commit 0ac02d620d

@ -10,7 +10,7 @@ namespace Rs.Framework
{ {
public static class ImageProcess public static class ImageProcess
{ {
static UInt64 imageNum = 0; //static UInt64 imageNum = 0;
public static ManualResetEvent manualTriggerEvent = new ManualResetEvent(false); public static ManualResetEvent manualTriggerEvent = new ManualResetEvent(false);
public static ManualResetEvent autoTriggerEvent = new ManualResetEvent(false); public static ManualResetEvent autoTriggerEvent = new ManualResetEvent(false);
@ -19,12 +19,12 @@ namespace Rs.Framework
public static void AddManualTrigger(HObject obj) public static void AddManualTrigger(HObject obj)
{ {
imageNum++; //imageNum++;
if (imageNum>20) //if (imageNum>20)
{ //{
GC.Collect(); // GC.Collect();
imageNum = 0; // imageNum = 0;
} //}
manualTriggerList.Add(obj); manualTriggerList.Add(obj);
manualTriggerEvent.Set(); manualTriggerEvent.Set();
} }
@ -33,6 +33,7 @@ namespace Rs.Framework
{ {
manualTriggerList.Clear(); manualTriggerList.Clear();
manualTriggerEvent.Reset(); manualTriggerEvent.Reset();
GC.Collect();
} }
public static HObject GetManualImage() public static HObject GetManualImage()
@ -51,21 +52,23 @@ namespace Rs.Framework
public static void AddAutoTrigger(HObject obj) public static void AddAutoTrigger(HObject obj)
{ {
imageNum++; //imageNum++;
if (imageNum > 20) //if (imageNum > 20)
{ //{
LogHelper.Debug($"imagenum={imageNum},释放内存"); // LogHelper.Debug($"imagenum={imageNum},释放内存");
GC.Collect(); // GC.Collect();
imageNum = 0; // imageNum = 0;
} //}
autoTriggerList.Add(obj); autoTriggerList.Add(obj);
autoTriggerEvent.Set(); autoTriggerEvent.Set();
} }
public static void ClearAutoTrigger() public static void ClearAutoTrigger()
{ {
autoTriggerList.Clear(); autoTriggerList.Clear();
autoTriggerEvent.Reset(); autoTriggerEvent.Reset();
GC.Collect();
} }
} }
} }

@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.20.24.1")]
//[assembly: AssemblyFileVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]

Loading…
Cancel
Save