6 Mar 2014 7:25 AM #1
Template - ItemdId - Memory leakSencha Touch version tested:
- Browser and devices
There is a memory leak if you use itemId in template elements the memory . Ext.dom.Element.cache increase every time you show a template.
- Create a list that use template (tpl:String/String/Ext.Template/Ext.XTemplate) for items
- Create a store with many elements
- Write template using some html elements (an heavy elements is better)
- Add to template elements an attribute itemId
- get this element by item.element.down
- call "store.load()" continuously
- The result that was expected:
The result that occurs instead:
Memory will be not released!
Ext.dom.Element.cache grow up!
6 Mar 2014 11:40 AM #2
The JS garbage collector releases memory at random times how long of a period are you testing over?
I would also suggest using the Chrome developer tools profile panel to check for leaks.
FYI when you take a heap snapshot in chrome dev tools it does initiate the garbage collector.
It would help expedite this issue if you put together a fiddle and verify that it reproduces this behavior.
7 Mar 2014 1:55 AM #3
I investigated better this behavior:
- I run a query on html element (in my case on element of an item template)
- senchaTouch creates an "Ext.dom.Element" for the query result element
- this element will be cached in "Ext.domElement.cache"
- nobody never will remove it.
am I doing something wrong?
7 Mar 2014 12:43 PM #4
You should not have to. Can you provide a fiddle that reproduces this behavior.
10 Mar 2014 2:54 AM #5
tap button many times and watch the browser console.
20 Mar 2014 9:07 AM #6
Thanks for the test case. I have verified that it reproduces the issue you are reporting. I am unfamiliar with the itemId attribute. For what purpose are you using it?
20 Mar 2014 9:14 AM #7
I think the problem is caused by the query that creates an Ext.Element independently from the field used for the query.
However I use itemId like Id: I use this field for have an identifier for every Component that I need to search. is it wrong? is there a better way?
20 Mar 2014 10:12 AM #8
Well id's are usually intended to be unique within a html document. The way you have it set up each list item will have the same id. I don't think it is necessary as you can use component query to retrieve your list based on its itemId (itemId: 'myList') and the getInnerItems() method to get access to the list items.
Check out the console results on the following fiddle: https://fiddle.sencha.com/#fiddle/4di