locked
leaflet in windows 8 rt javascript app freezes on zoom

    Question

  • Hello,

    I have created a windows 8 app using javascript and HTML5 for windows 8.1. The app contains a leaflet 0.7.2 map on 3 of the pages in my SPA. I have a similar application which runs great in the browser. The winrt app also works great while debugging. The problem only occurs when i'm not debugging, the map then starts freezing on zoom. When i use the app slowly the map hardly ever freezes, but when I zoom 5-10 times quickly in a row, the map freezes. And the only way to  make it responsive again is to navigate to another page and then back to the page containing the map.

    I tried the following and these things are still active in my app: 
    - set a timeout around my zoomanimation and loadtile function
    - set zoomanimation and fadeanimation to true
    - i set unloadinvisibletiles to true.

    I turned on WinJS logging and i've set WinJS.Application.onerror to log if an error occurs. But no errors or exceptions get thrown whatsever.

    Does anyone know what I can do do solve this nasty bug?

    Thanks in advance,

    Ian

    Monday, February 24, 2014 3:35 PM

All replies

  • Hi Ian,

    Seems to be a performance issue, hardly to tell why, but I would suggest you to checkout your memory usage, 150MB is a system limitation, if your app memory usage is larger than this amount, the app definitely freezing.  I guess your app is in such situation.

    Read this for more information: Analyze memory usage (JavaScript), running a JavaScript memory analyzer is quite necessary for you to analysis your app memory usage.

    If you could upload a demo for us to test, that would be better.

    Thanks and best regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    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.

    Tuesday, February 25, 2014 2:59 AM
    Moderator
  • Hello James,

    My app does use more than 150MB when panning and zooming with leaflet. But the app doesn't freeze only the map does. Is this behavior to be expected?

    I'll start with the memory analysis asap. If I verify that the memory was the issue i'll mark your answer as "the answer".

    Thank you for your help.

    Regards,

    Ian

    Tuesday, February 25, 2014 8:34 AM
  • Hello Ian,

    The 150MB limitation comes from this blog: http://blogs.msdn.com/b/windowsappdev/archive/2012/04/03/how-to-improve-performance-in-your-metro-style-app.aspx

    But I'm able to understand what do you mean by app doesn't freeze, for instance you have some buttons on the other part of screen and while the map freezing, your app can still response the button click event in a very short time.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    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.


    Wednesday, February 26, 2014 9:04 AM
    Moderator
  • Hello James,

    You are correct. The map freezes and becomes unresponsive. Every other button on the screen still reacts instantly.

    Regards,

    Ian

    Friday, February 28, 2014 2:29 PM
  • Hello James,

    The issue still persists. I can't reduce the memory usage because the function that is burning alot of memory is required to run in the way it does. I can't seem to allocate more memory, i only found examples for windows phone to increase the memory.

    Do you know of anything else i could try?

    Thanks in advance,

    Ian

    Tuesday, March 18, 2014 3:22 PM
  • Hi Ian,

    Talked with Matt via email, and he points out that 150MB is not a correct limitation, the number from blog is a suggested size but not the limitation size.

    I'm so sorry for that and apologize for mis-leading you.

    And as Matt post in another thread, I think if you can post a demo that would help us analysis the project.

    Sorry again.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    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.

    Wednesday, March 19, 2014 2:53 AM
    Moderator
  • Out of curiosity, why aren't you just using the Bing Maps SDK for Windows Store apps. Its the only map control that was specifically designed for Windows Store apps. Over 95% of maps in Windows Store apps are using this control. I have a whole book (free ebook) on how to create location intelligent windows store apps that revolves around this control: http://rbrundritt.wordpress.com/my-book/

    http://rbrundritt.wordpress.com

    Wednesday, March 19, 2014 10:45 AM