I am currently migrating an existing C # Windows 8 / iOS application to Android (with Xamarin).
I used a lot of asynchronous / pending I / O files, dialogs, networks, etc.
What happens when an application pauses / pauses while waiting? There are two options on Windows and iOS:
- the application resumes later as if nothing had happened
- application terminates if memory is low.
In both cases, a memory leak does not occur; there are no changes in the control flow.
However, under Android, activity can be destroyed and recreated while the process remains alive. In my understanding of async / await, this means:
- an open dialog will wait forever, which means that objects accessible from the caller ("this", local variables, etc.) will remain in memory forever (memory leak)
- when the expected network request is completed and the previous activity has already been destroyed by Android, the code after βwaitingβ (for example, writing a file) may collide because there are two working instances of Activity.
Are my assumptions really? If so, what can be done? (without making the program as complicated as before for inventing async / await)
source share