Kleptine
Kleptine

Reputation: 5087

Android Get Total App Memory (Heap + External Allocations)

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!

Upvotes: 1

Views: 1795

Answers (1)

Robby Pond
Robby Pond

Reputation: 73484

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.

Upvotes: 1

Related Questions