0

I've got a spark ListForm with a custom mxml itemRenderer, all the itemRenderer has is:

<s:Label text="{data.name}" />

When I run the profiler, the listform is not re-using the itemRenderers, the instances keep going up and up, I'm using an arrayCollection as the dataprovider. I even call the dataprovider (arrayCollection) .removeAll() and the display goes blank, yet the number of instances of the itemRenderer does not go down. I then run the garbage collector in the profiler, and the item renderers still stay in memory. How can I remove the itemRenderers from memory?

stevemcl
  • 367
  • 1
  • 3
  • 11
  • Show us your complete renderer; for starters. I didn't think the top level component of a Spark itemRenderer could be a label. Also don't use binding; which does odd things; instead listen for the dataChange event and update the text that way. Also make sure you are using virtualLayouts. I think that is a property on the layout class. – JeffryHouser Oct 04 '11 at 06:32
  • Are you by chance using itemRendererFunction? Prior to Flex 4.6 itemRendererFunction doesn't recycle item renderers. See the last few slides in this talk for more information: http://flexponential.com/2011/10/05/performance-tuning-mobile-flex-applications/ – sshongru Oct 16 '11 at 00:12

2 Answers2

1

if you just want a label as an item renderer then in mobile applications it's recommended to use the LabelItemRenderer

user273895
  • 654
  • 5
  • 16
0

Set the itemRenderer to null. When GC next runs, the item renderers in memory will be removed.

Reado
  • 1,412
  • 5
  • 21
  • 51