I discovered that a polling AIR application slowly uses more and more memory, probably because of the garbage collection algorithm.
These two screen shots show the memory usage displayed in the Flex profiler of an application that polls XML data from a Web server every 3333 ms:
As you can see, the application slowly uses more and more memory, because the GC does not run until it needs more memory. Each time it hits the threshold, it reserves additional memory for one RPC run and then collects the memory.
This is the same application, but it has an callLater(System.gc) in the result event of the HTTPService. Memory usage stays flat:
Is there another solution to this behaviour than calling System.gc()?
Cache your objects on the client and only update them instead of creating them
on every server call. The idea is to only create an object if is not already
created. Otherwise updates its property's.
Thanks for your suggestion, but here are more details about the application:
It is a very simplistic application, there are no objects being created programmatically. HTTPService.send() is being called in a Timer, and then HTTPService.lastResult.someXMLList is being bound to the dataProvider of some DataGroups which are reusing there children if I am not mistaken. I assume the additional memory being reserved is used by the internal result object structure of the HTTPService.