7

I want to test our app for low memory cases.

Do you have any ideas, how to cause onLowMemory on devices?

Thank you.

Tima
  • 12,765
  • 23
  • 82
  • 125

1 Answers1

1

I just know only one way to do, which is to create a method running in a different thread that does memory leak, make it loop continuously until onLowMemory() is called, then stop the thread.

It's nice if anyone shares experiences on this case!

Pete Houston
  • 14,931
  • 6
  • 47
  • 60
  • Indeed, a workmate of me wrote a small app doing something like this. But it works fine in emulator on his mac and doesn't word everytime on my windows pc and my devices – Tima Oct 06 '11 at 21:02
  • 4
    If I am not mistaken, this doesn't work because onLowMemory() is called when the whole system memory becomes low. each process has a limit, and when that limit is run out, an exception is thrown without affecting the whole system – michelle Oct 24 '11 at 13:25