Memory leak when calling SerialPort.Write() loop #1721
|
In my project, a file about 1MB should be sent via the serial port. So I call the SerialPort.Write in a for loop. for (int i = 0; i < packNum; i++) log output: |
Replies: 2 comments 8 replies
|
Can you try to run the loop without calling the sp.Write, see if there is still a memory leak. |
|
I created a simple project that only calls the sp.Write() looply, it works well. Following the AI's advice, I changed the native code like below. void UartTxWorkerTask_sys(void *pvParameters) // other codes... HRESULT Library_sys_io_ser_native_System_IO_Ports_SerialPort::Write___VOID__SZARRAY_U1__I4__I4(CLR_RT_StackFrame &stack) // other codes... |
Fixed in nanoframework/nf-interpreter#3277