locked
Windows UWP SerialDevice memory leak RRS feed

  • Question

  • Hi @ all!

    Using the SerialDevice produces verry much handles an the memory usage of the app increases!

    Visual Studio Enterprise 2015 Update 3 + Last Patch

    Test Machine: Windows 10 Enterprise x64 on Lenovo i7-4700

    I wrote a Little app for testing - here the code snippet:

            private async System.Threading.Tasks.Task<bool> test()
            {
                string aqs = SerialDevice.GetDeviceSelector();
                Windows.Devices.Enumeration.DeviceInformationCollection dis = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(aqs);
    
                foreach (var x in dis)
                {
                    string deviceId = x.Id;
                    // generate 1 handle
                    SerialDevice serialPort = await SerialDevice.FromIdAsync(deviceId);
                    if (serialPort == null)
                        continue;
                    // generate 1 handle
                    serialPort.BaudRate = 9600;
    
                    // generate 1 handle
                    if (serialPort.BaudRate != 9600)
                        serialPort.BaudRate = 9600;
    
                    if (serialPort != null)
                        serialPort.Dispose();
    
                    serialPort = null;
    
                    /*
                     * 3 Handles and never be released!!!!
                     * looks like memory leak!!!
                     */
    
                    // exit - using only one serial port
                    break;
                }
                return true;
            }


    • Moved by IoTGirlMicrosoft employee Thursday, July 21, 2016 6:19 AM Not IoT Specific
    • Edited by cmikula Thursday, July 21, 2016 6:24 AM Change title because thread moved
    Thursday, July 21, 2016 6:11 AM

All replies

  • Hi cmikula,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Best Regards,

    Xavier Eoro


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, July 22, 2016 5:12 AM
  • Any news?
    Thursday, October 6, 2016 7:26 AM