Dynamically generated UI Elements make Air hang
Hi there everyone!
This is question that most probably come from my limited knowledge of the Adobe Flex framework and its functioning but so far I was unable to retrieve the required information all by myself.
So the problem is: I have an Adobe AIR desktop application (SDK 4.1 / 4.5) that generates UI Elements dynamically and adds them to the main stage surface by the <applicationInstance>.addElement(<UIElement>);. Once not required anymore, I just remove them from the stage interface by the <applicationInstance>.removeElement(<UIElement>);. the UI elements are generated by a Timer. back.
The application hangs and stops responding after a while. the faster I generate the elements, the sooner it hangs. There are no more than 25 elements displayed on the stage in the same time. Nonetheless the application freezes by throwing an exception to Adobe Flash Builder that would eventually close the application and say it terminated unexpectedly.
My guess is that somehow the Elements are not completely removed by the removeElement, or the addElement method keeps on feeding the stack even though some indexes are already freed. Each UIElement loads a quite big resource eating some RAM as well, but I checked the memory usage of the application and it is steady with no memory leak, so the Elements seem to be removed and the memory is given back in fact.
Could anyone help me please what is the proper method to implement this kind of behaviour or let me know if I'm looking for the cause of this problem at the wrong place and the problem comes probably from somewhere else?
