Memory leaks in SharePoint hosted single page app

Hi Everybody,

I am developing a SharePoint 2013 hosted app and use REST and/or CSOM queries to retrieve items from lists and use them on a single page app (SAP). Because the page is not refreshing, big amounts of memory leaks that otherwise wouldn't be a problem become a huge issue and the app reaches its maximum allowed memory and crashes. I use IE Developer Tools to monitor the memory and compare snapshots. Looks like jQuery is caching the data that I put on the view, including the various handlers, and every time I change the data on my view as much as 7 MB is retained. I am attaching an image of the details and where I traced a circular reference on a function that is abbreviated. I am quite lost about what I can do here. Is there a magical way to prevent (if this is even relevant here) jQuery from caching some or all of the data? Any idea or info is much appreciated.



May 25th, 2015 10:16am

How have you written javascript code?Do you use lot of global varibles?Are you using IFFY model to write javascript functions?Are you using too much of document.ready()?


Thanks

Bhism

Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 3:00am

Hi,

According to your description, my understanding is that you want to find a way to prevent Jquery Caching data release the memory.

I suggest you can use setTimeOut Trick Function to reset form or refresh the page to release the Jquery cache.

Here is  a detailed article for your reference:

Preventing Form Caching With Javascript And jQuery

Another option is that you can set the page to no-cache mode by Jquery or html tag, you can refer the article below:

How to stop caching with jQuery and javascriptHow to stop caching with jQuery and javascript

Thanks

Best Regards

May 26th, 2015 3:38am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics