MacOS 10.9, SDK 3.2.0, Alloy 1.3.0
Hi,
I have been running some instrument tests on a simple ListView in iOS using a template and a small number of generated rows
Index.xml is
<Alloy> <Window class="container"> <Button id="reloadButton" onClick="doClick" title="Load List" height="30" top="25"/> <Button id="clearButton" onClick="doClear" title="Clear List" height="30" top="5"/> <ListView id="testList"> <Templates> <ItemTemplate name="myItem" id="myItem"> <Label bindId="title" id="title" /> <Label bindId="value" id="value" /> </ItemTemplate> </Templates> <ListSection id="mySection" /> </ListView> </Window> </Alloy>and the index controller is
// clear the list function doClear(e){ $.mySection.setItems([]); } // reload the listview function doClick(e){ var items=[]; for(var i=0; i<4; i++){ items.push({ 'template': 'myItem', 'title':{'text': 'aaaaaaa'}, 'value':{'text': 'bbbbb'} }); }; $.mySection.setItems(items); } $.index.open();index.tss is
".container": { backgroundColor:"white", layout: 'vertical' }, "#myItem":{ height: 80 }, "#title":{ font: {fontSize: 14, fontWeight: 'bold'}, color: 'red', left: 15, top: 5, height: 20, right: 15 }, "#value":{ font: {fontSize: 12, fontStyle: 'italic'}, color: 'blue', left: 15, top: 20, height: 20, width: Ti.UI.SIZE }And the results(Living) each time I do a load and then a clear are:
TiUILabelProxy: 8,8,12,12,16,16 TiIListItemProxy: 4,4,6,6,8,8 TiUILabel: 8,8,12,12,16,16 TiUIListItem: 4,2,4,2,4,2Now while the actual ListItem seems to clear, everything else just builds up and although this is just a test I have a complex iOS/Android app that I am nearing completion of that uses ListView exclusively.
I am now wondering if this apparent leak is going to cause a problem with the complex templates that I am using in the app.
I have tried other ways of removing the list items ( i.e. deleteItemsAt etc.), but nothing seems to make a difference.
It looks to me like the Label components in the template are the issue here, but is there a correct way of releasing the memory that appears to be building up using the List Item Templates the way I am?