0

When a user opens a different app, the previous app would be cached in the memory, except the user kills it explicitly, or the memory gets too low. As the user continues using different apps, more and more apps may be cached in the memory based on the LRU policy.

The number of cached apps may depends on what apps would be cached and what is the total available memory, as different apps consume different amounts of memory.

Let's assume the total available memory is always sufficient, then how many apps can be cached in the memory at most? Is this number fixed across different Android versions? Does it depends on the devices' parameters?

On my nexus 7 with Android 4.2, it seems this number is 10. Correct me if you find it wrong.

Kara
  • 6,115
  • 16
  • 50
  • 57
JackWM
  • 10,085
  • 22
  • 65
  • 92
  • 2
    There's no fixed number. The OS scheduler can and will terminate apps based on a number of factors that you can't control. Further, the device manufacturers modify the scheduler's behavior to suit their preferences. Just handle the lifecycle callbacks properly and you'll be fine. – Krylez Aug 20 '13 at 17:59

1 Answers1

1

As far as I know, there is no number of apps limit. The limit is dynamic based on available memory on the device as well as actual memory used by each open app. For example, if you have an app that uses a few large bitmaps, and then open the gmail app, your app will be killed.

yoah
  • 7,180
  • 2
  • 30
  • 30