System.IO.Ports.SerialPort memory issue on WINCE 5.0 device using .Net CF 3.5

Apr 9, 2008
Reaction score
I am trying to solve a memory leak issue when accessing a serial port on a WINCE 5.0 device. My application is devloped in MSVS2008 and uses .NetCF 3.5. I have pinpointed the leak was due to a third party serial port DLL so I tried to implement the Microsoft SerialPort class. Unfortunately the memory leak still exists. I cut my code back to just the reading of the data buffer (see below) but the memory still keeps dropping constantly. Any suggestions of how to solve this problem?

private void PortOnRead(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)




byte[] bData = new byte[this.sPort.BytesToRead];

int iRead = this.sPort.Read(bData,0,bData.Length);

// To Do

this.dtReceived = DateTime.Now;


catch { }




Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question