I have a code like this:
<mx:Repeater id="allItemRepeator"
dataProvider="{_model.allItems}"
>
<components:ComponentSelector id="componentSelector"
dataLoad="{allItemRepeator.currentItem}" />
</mx:Repeater>
When code changes for allItems the item disapears from screen as expected but still sits in memory! I know this by a function inside a compoenent that has “trace” so the trace output still displays even after the component disappears from screen. How do I ensure that the element is deleted when it’s reference is deleted? Will using List-based component to display items instead of “Repeator” solve the problem (it requires significant refactoring of my code so I’m asking before trying it out)
Something is still holding onto a reference to the component, so it is not being garbage collected. Binding in particular (which I notice you are using) is notorious for this.
Best way to debug the problem is to run your application though the profiler and see what is keeping a reference to the component once it is removed.