locked
[U8.1]High CPU / Memory leak in Windows 8.1 Universal Apps RRS feed

  • Question

  • I'm pretty sure I've found a memory leak in Windows 8.1 Universal Apps.

    I'm trying to build an app with a rich text editor and kept coming across the same bug, no matter what editor I used. In a document over a certain size, when a block of text is pasted at the cursor, the app slows down dramatically. After a paste event, there is a serious lag when typing anything.

    I've narrowed the problem down to the insertNode command, which most rich text editors use. I've created a simple Windows 8.1 Universal App which reproduces the problem reliably.

    https://onedrive.live.com/redir?resid=EE99EF9560A6740E!230777&authkey=!ACBcfSH4H1BE1s8&ithint=file%2czip

    Run the app, click anywhere on the editor and type. You'll see it works at the speed you'd expect. Next, press tab and three paragraphs of 'Lorem Ipsum' will be pasted in. Now try typing again. You should be able to notice the lag. Pressing tab another few times will increase the lag dramatically.

    I'm not great at debugging, but I ran VS Diagnostic tools on the app and found the memory does not dramatically increase, but CPU usage does. 

    As you can see, CPU usage is noticeably higher when typing after each paste event. 

    This bug does not affect 'Windows 10' Universal Apps - They appear to use a newer version of WinJS and don't suffer any lag when using insertNode.

    Has anyone seen this issue before? Anyone got a fix or a workaround? I'd like my app to be usable in Windows 8.1 as it's an update to an existing app and the majority of my users are on Windows 8.1


    • Edited by Barry Wang Friday, November 13, 2015 3:08 AM Edit title
    Thursday, November 12, 2015 10:49 AM

All replies

  • Hello Roryok,

    Unfortunately I was not able to reproduce the issue on my side. while I pressed tab multiple times all the time my it works perfectly and CPU usage did not spike. Could you confirm that this issue only happens on your machine or not. it could be that same thing works fine on another machine then I suspect issue lies with the machine and not the Windows app.

    With Regards,

    Krunal Parekh


    Thanks MSDN Community Support Please remember to Mark as Answer the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, November 13, 2015 8:23 AM
  • Hi Krunal

    I have tried this on two separate machines, running Windows 10 developer preview and Windows 10 RTM, both observe the same behaviour. 

    I have also encountered this same issue on a third machine running 8.1 although I have not run this exact app sample on that machine as I no longer have access to it. 

    UPDATE:

    I've now tried it on a Windows 8.1 machine, and cannot reproduce the issue. So just to be clear, this issue affects Windows 8.1 Universal Apps running under Windows 10.

    Windows 8.1 Universal App, Windows 8.1 - No Lag
    Windows 8.1 Universal App, Windows 10 - LagWindows 10 Universal App, Windows 10 - No Lag

    There is no way I know of to upload a separate package for Windows 10, so its not possible to get around this issue

    • Edited by Roryok Friday, November 13, 2015 11:12 PM
    Friday, November 13, 2015 11:10 AM
  • Hello Rotyok,

    >>Windows 8.1 Universal App, Windows 10 - Lag

    When I tried this My CPU did not spike but I could see some lag in the typing after pressing the tab. Since insertAtCursor is browser javascript method I am not really sure how to trouble shoot this issue. It could be related to rendering engine of browser. Since in 8.1 uses IE 11 and win 10 uses edge rendering engine.

    With Regards,

    Krunal Parekh


    Thanks MSDN Community Support Please remember to Mark as Answer the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, November 20, 2015 7:45 AM
  • My "insertAtCursor" method uses range.insertNode which is what causes the issue. If you comment out this one line, there is no issue. If you use a third party rich text editor which uses range.insertNode, the issue is there too.

    Now that you can replicate the issue, please report it to the Edge browser / rendering engine team and hopefully they can fix it and apply a patch. 

    Once again I have to say, although you point out that 8.1 uses the IE11 rendering engine, I definitely have encountered this issue on Windows 8.1. I've been seeing this issue intermittently for over a year and only switched to Windows 10 in August. The IE11 rendering engine ALSO has this issue, but I cannot replicate it reliably. Whatever issue is found in Edge will definitely be present in IE11 also. 

    Friday, November 20, 2015 9:21 AM