Join GitHub today
JQuery Mobile Memory Leak while transitioning from one page to another #6895
I submitted a bug report earlier (issue 6816), which was rejected due to missing JsBin. Here one example with a JsBin.
Issue description When navigating between pages with JQM a memory leak occours.
Test page Go to http://jsbin.com/UqaGuMu/4
Steps to reproduce a) Bring up the test page. Go to page 1 click on link to go to page page 2. Go back to page 1. b) Open Google Chrome Dev Tools and take a heap snapshot. c) Now repeat going from page 1 to page 2 about 10x. d) Take another heap snapshot. e) Compare heap snapshot 1 with 2. You will see a difference of about 100k. See the screenshot attached.
Expected outcome I expect the memory to be constant after i visited every page at least one. In a real world app, the leak may be much bigger depending on the complexity of the page. The memory grows and leads to a resource shortage which may cause several problems.
Actual outcome The memory increases. 10x switching between page1 and page2 increases the memory of about 100k. See screenshot attached!
Platforms/browsers (including version) and devices tested Latest Google chrome browser. Seen on real android 4.2 devices where page got slower over time of usage.
jQuery Mobile and jQuery core version used JQM 1.4.0 release. JQuery 1.9... The leak also shows with JQuery version 2.x.
Other relevant information, e.g. using PhoneGap No phonegap.
Thanks for looking at this. In a real world app that is really an issue since the detached DOM may be much bigger. Further in a real world app there are even more reasons for leaks (usually closures of widgets).
I learnt, that a JsBin is required for a correct bug submission. I think this could be a risk when dealing with memory leaks, since every additional framework/component may cause the leak itself. I tested that with a plain standalone version too, so we can be sure, it's not realated to JsBin in that case.