1

In my android app, is there any way to get the total amount of memory my application is taking up, in the code. I'm using lots of large bitmaps, so it must include external allocations as well. I must, however, be able to get the number in the code, so that I can dynamically adjust to fit the budget I have.

I also need a way to get the total amount I have available (16Mb or 24Mb) as well.

Thanks!

Kleptine
  • 5,032
  • 15
  • 55
  • 79
  • I have only made 1 app for android... but it seems like you don't think of memory usage in terms of "when my app is running, I use X memory"... but instead "when I am on THIS specific screen, I use x memory." And along that line, do you use enough memory on 1 screen to need to worry? – bwawok Jul 07 '10 at 01:46
  • Yes, I only have a single main Activity in my app (other than a simple settings menu). Everything else uses next to nothing, where my main Activity easily uses up the entire 16Mb on larger screened phones. – Kleptine Jul 07 '10 at 02:26

1 Answers1

1

Then you should rewrite it to not use so much memory. Any time working with multiple large bitmaps you are liable to run out of memory. You need to downsample the image, e.g. there is no point in load a full 8MP photo when your device can't display the full size image.

Here is a great answer regarding memory usage on Android.

Community
  • 1
  • 1
Robby Pond
  • 70,876
  • 16
  • 121
  • 117
  • That's not an option nor the answer I'm looking for. As I explained in the comment, my app is literally impossible to write without using the memory it uses. I can scale it down, but I only want to do that when I am low on memory in general. – Kleptine Jul 08 '10 at 03:21
  • The application is as optimized as physically possible. – Kleptine Jul 08 '10 at 03:22