Android's Policy for throwing processes out of memory

view story

http://stackoverflow.com – I have a service in Android which takes a lot of memory and is occasionally removed from running. What is the rule by which Android decides to remove a process? If so - how can I tell I'm about to stop running due to too much memory consumption? Most of the memory I allocate is allocated in native code. (HowTos)