low-memory

How to force a service restart?

回眸只為那壹抹淺笑 提交于 2019-11-27 07:28:42
I have a background service that sometimes gets killed by the OS when it is running low on memory. How to simulate this behaviour so I can debug it? The dev guide simply says "if your service is started, then you must design it to gracefully handle restarts by the system. If the system kills your service, it restarts it as soon as resources become available again". What's the sequence of calls from when it gets killed to when it finishes restarting? On a side (related) question, what happens to an actively running AsyncTask started in the service when the service gets killed by the OS, i.e.,

Memory-mapped files and low-memory scenarios

两盒软妹~` 提交于 2019-11-27 05:24:32
问题 How does the iOS platform handle memory-mapped files during low-memory scenarios? By low-memory scenarios, I mean when the OS sends the UIApplicationDidReceiveMemoryWarningNotification notification to all observers in the application. Our files are mapped into memory using +[NSData dataWithContentsOfMappedFile:], the documentation for which states: A mapped file uses virtual memory techniques to avoid copying pages of the file into memory until they are actually needed. Does this mean that

Android : Static variable null on low memory

こ雲淡風輕ζ 提交于 2019-11-27 00:46:18
I have an application which has some static variables. These variables are stored in an independent Class named DataContext. These variables are initialized from raw files at the application start (a method named DataContext.initConstant() is called in the onCreate() of MyApplication which extends Application). (EDIT : the initConstant method use an AsyncTask to load this data from files). When my application comes to the background for a certain time or when my application used to much memory, these static variables become null. How can it be prevented? If not what should I do with my static

How to force a service restart?

a 夏天 提交于 2019-11-26 13:18:37
问题 I have a background service that sometimes gets killed by the OS when it is running low on memory. How to simulate this behaviour so I can debug it? The dev guide simply says "if your service is started, then you must design it to gracefully handle restarts by the system. If the system kills your service, it restarts it as soon as resources become available again". What's the sequence of calls from when it gets killed to when it finishes restarting? On a side (related) question, what happens

Linux memory overcommit details

 ̄綄美尐妖づ 提交于 2019-11-26 10:03:22
问题 This question was migrated from Server Fault because it can be answered on Stack Overflow. Migrated 6 years ago . I am developing SW for embedded Linux and i am suffering system hangs because OOM Killer appears from time to time. Before going beyond i would like to solve some confusing issues about how Linux Kernel allocate dynamic memory assuming /proc/sys/vm/overcommit_memory has 0 and /proc/sys/vm/min_free_kbytes has 712, and no swap. Supposing embedded Linux currently physical memory

Android : Static variable null on low memory

谁说我不能喝 提交于 2019-11-26 09:27:33
问题 I have an application which has some static variables. These variables are stored in an independent Class named DataContext. These variables are initialized from raw files at the application start (a method named DataContext.initConstant() is called in the onCreate() of MyApplication which extends Application). (EDIT : the initConstant method use an AsyncTask to load this data from files). When my application comes to the background for a certain time or when my application used to much