Device.VCI_ClearBuffer(ChargeModel.DevType, ChargeModel.DevIndex, ChargeModel.CANIndex);
BmsIssueCan("10 09 00 02 FF 00 11 00 ", "1CEC56F4", ChargeModel);
Thread.Sleep(10);
IntPtr pt = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VCI_CAN_OBJ)) * (Int32)con_maxlen);
res = Device.VCI_Receive(ChargeModel.DevType, ChargeModel.DevIndex, ChargeModel.CANIndex, pt, con_maxlen, 0);
BMSService.Default.BCS_Timer_rec_Tick(res, pt, ChargeModel);
flush.Flush();
因为在while循环中一直取数据 导致使用
IntPtr pt = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VCI_CAN_OBJ)) * (Int32)con_maxlen);
从而一直分配系统空间 导致内存不足
文章讨论了在IT设备中,尤其是在处理CAN通信时遇到的内存溢出问题,涉及Device.VCI_Receive函数的使用以及如何解决因持续接收数据导致的系统内存不足问题。
8003

被折叠的 条评论
为什么被折叠?



