什么是抱着我的活动的状态,一旦我的应用程序已经被杀死?我的、抱着、被杀、应用程序

2023-09-12 05:06:29 作者:久爱不弃

我一直在测试运行,迫使我的应用程序被杀害内存,吃我的应用程序的行为。看完答案后,Where是的onSaveInstanceState束得救吗?,我感到困惑的一些结果我看到了。

在该链接给出两个答案意味着个人的活动,而不是应用程序,当内存需要被回收销毁。但根据 http://developer.android.com/guide/components/流程 - 和 - threads.html ,过程 - 而不是单独的活动 - 被杀害。由于所有组件通常是在同一个进程中运行,我希望整个应用程序在内存不足的情况​​下被杀死。我的测试是在Android的文件一致我再也看不到进程在运行,当我跑我的记忆里吃的应用程序。

因此​​,如果整个过程被杀死了,我是正确的假设,在这个问题给出的答案是不正确的?但如果是这样,有什么让我的包,当我恢复我的应用程序,如果这个过程被打死?是不是真的保证永远不会被写入磁盘?

解决方案   

在该链接给出两个答案意味着个人的活动,而不是应用程序,当内存需要被回收销毁。

怀中抱猪杀 敲对手脑瓜 全新版本明天就来了

这是不正确的,虽然我很困惑在这一点上很长一段时间我自己。

恕我直言,最多的一个三个答案对这个问题的意味着个人的活动,而不是应用程序,被破坏的时候内存需要回收。

  

但如果是这样,有什么让我的包,当我恢复我的应用程序,如果这个过程被打死?

有时候,没有什么是保持[你]包左右。其他时候,这个过程的核心操作系统是保持[你]包左右。

  

难道真的保证永远不会被写入磁盘?

不是保,因为它不记录是否被写入磁盘。如果它的是的写入磁盘,它会被一个操作系统进程(不是你)这样做,并且该文件应该是不可读的其他进程。

I've been testing the behavior of my program by running a memory-eating application that forces my application to be killed. After reading the answers to Where is the bundle of onSaveInstanceState saved?, I'm confused about some of the results I'm seeing.

Both answers given in that link imply that individual activities, not applications, are destroyed when memory needs to be reclaimed. But according to http://developer.android.com/guide/components/processes-and-threads.html, processes - not individual activities - are killed. And since all components usually run in the same process, I would expect the entire application to be killed in low memory situations. My testing is consistent with the Android documentation in that I no longer see the process running when I run my memory eating app.

So if the entire process is killed, am I correct in assuming that the answers given in that question are incorrect? But if so, what's keeping my Bundle around when I resume my application if the process was killed? Is it really guaranteed to never be written to disk?

解决方案

Both answers given in that link imply that individual activities, not applications, are destroyed when memory needs to be reclaimed.

That is incorrect, though I was confused on this point for a long time myself.

IMHO, at most one of the three answers on that question "imply that individual activities, not applications, are destroyed when memory needs to be reclaimed".

But if so, what's keeping my Bundle around when I resume my application if the process was killed?

Sometimes, nothing is "keeping [your] Bundle around". Other times, a process central to the OS is "keeping [your] Bundle around".

Is it really guaranteed to never be written to disk?

Is not "guaranteed", insofar as it is not documented whether or not it is written to disk. If it is written to disk, it will be done so by an OS process (not yours), and the file should be unreadable by other processes.