]> git.wh0rd.org Git - tt-rss.git/commitdiff
add some hacks to hopefully mitigate headlines memory leaks
authorAndrew Dolgov <fox@fakecake.org>
Sun, 10 Jan 2016 22:11:26 +0000 (01:11 +0300)
committerAndrew Dolgov <fox@fakecake.org>
Sun, 10 Jan 2016 22:11:26 +0000 (01:11 +0300)
js/feedlist.js
js/viewfeed.js

index c9ff121d78c06611cecfd885ed94241ed7f1a94c..eb6cbdfee220c30c30b51700559548df27a34ac2 100644 (file)
@@ -51,6 +51,23 @@ function loadMoreHeadlines() {
        }
 }
 
+function cleanup_memory(root) {
+       try {
+               var dijits = dojo.query("[widgetid]", dijit.byId(root).domNode).map(dijit.byNode);
+
+               dijits.each(function (d) {
+                       dojo.destroy(d.domNode);
+               });
+
+               $$("#" + root + " *").each(function (i) {
+                       i.parentNode ? i.parentNode.removeChild(i) : true;
+               });
+       } catch (e) {
+               console.log("cleanup_memory: exception");
+               console.log(e);
+       }
+}
+
 function viewfeed(params) {
        try {
                var feed = params.feed;
@@ -83,6 +100,8 @@ function viewfeed(params) {
                        if (getActiveFeedId() != feed || !infscroll_req) {
                                setActiveArticleId(0);
                                _infscroll_disable = 0;
+
+                               cleanup_memory("headlines-frame");
                        }
 
                        if (infscroll_req) {
index 3b647e08085b9f757e4ef70ceb870b6c8c552125..181a932e0ac64c06d83156235f965af483fe4f85 100755 (executable)
@@ -244,6 +244,8 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
 
 function render_article(article) {
        try {
+               cleanup_memory("content-insert");
+
                dijit.byId("headlines-wrap-inner").addChild(
                                dijit.byId("content-insert"));