-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handlebars.js is causing a memory leak in IE9 #271
Comments
Hi guys, I tried to isolate the problem, and wrote a tiny program to test whether handlebar.js has memory leaks on IE9. Here is the code.
And the HTML code is here:
The memory of IE just keep climbing up and never goes down. Can some one please have a look at this. Thank you very much. Cheers |
Possibly a workaround, is avoid doing this on every render: |
Compiling the template multiple times could definitely cause a leak. If this does not resolve the problem, we can reopen. |
Thank you very much for your help. I had to switch to knockout.js to resolve the issue, because I need the view update its value real time. However, I am really curious that if it is possible to update the view without compiling the template multiple times using handlebars. |
You can compile it only once. Once you do Handlebars.compile(template) you
|
For example: var template = Handlebars.compile("<b>{{myString}}</b>");
template({ myString: "value1" }); //=> "<b>value1</b>"
template({ myString: "value2" }); //=> "<b>value2</b>" |
Although its quite an old issue, we have huge memory leaks happening when compiling templates of size > 32kb. For now we have switched to mustache.js which has resolved the memory leak. I think the root cause of the issue should be fixed. |
Hi there,
I am wondering if any one else experience memory leak from compile function.
I am working on a single page app which polls data periodically from server via Ajax call. Every time when I get new data, I re-render the view. (I am using Backbone.js in conjunction. I understand that I need to manually free view objects when I close the view and switch to other view, but that is not the case here. At least, I think it is not. Regarding to this topic please see this link: http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/ )
Here is my code:
If I comment out "var el = view.html(templateResult);" I won't have memory leak issue. As soon as I enable this line, the IE 9 memory consumption just start to raise. (I am forcing the view to re-compile the template every 0.5 seconds for testing purpose.)
I would like to know if there is a known memory leak issue in Handlbar.js or it is something I am doing wrong.
Thank you very much in advance.
Cheers
The text was updated successfully, but these errors were encountered: