5

Samsung Galaxy S3 uses 32mb heapsize almost instantly on my app, where on almost any other android device it starts at +- 5mb (saw this in logcat, can send screenshots from two different devices if necessary). Think this is the reason for my app crashing with "OutOfMemory" Exception's on only the Galaxy s3, works perfectly on the galaxy Y Duos and Pocket.

Any Help/Advice on why this is happening would be greatly appreciated thanks.

SpetsnaZ
  • 51
  • 4
  • 1
    on what the OOM exception is thrown? are you using Bitmaps, Buggy API, clear that to help you. – Mohammad Ersan Aug 28 '12 at 12:44
  • 1
    It is thrown during a bitmap factory decode. However I'm trying to figure out why it happens only on the Galaxy S3 It runs perfectly on any other android phone I have, My actual question being "Is there a bug with the galaxy using so much more heap than other android phones? – SpetsnaZ Aug 28 '12 at 12:58
  • Are the phones you're testing on running same Android OS version? – harism Aug 28 '12 at 13:06
  • Yes I have both a Galaxy Y Duos and Pocket, both are 2.3.6, an I have 2x Galaxy S3. – SpetsnaZ Aug 28 '12 at 13:11
  • 1
    The reason the s3 uses 32mb at start is because it uses xhdpi. Which the images are much bigger than the galaxy Y Duos – Mario Aug 28 '12 at 14:58
  • I'm currently got all my images(same size) in the drawable folder, not separated into each density with different sizes, would it be better to make a different size image for each screen density or does the automatic resizing work fine? – SpetsnaZ Sep 03 '12 at 06:25
  • I'm having this problem with Galaxy s4. What shoud we do ? – alicanbatur Oct 07 '13 at 11:02

2 Answers2

1

As told by mario, the problem is that s3 resolution is higher than those other models, so images are bigger in dimensions and, therefore, also in memory consumption.

Although it is worth to say that the S3 seems to have a little maximum heap size givin its resolution, since I have also had out of memory problems with it but not with other devices with same resolution that has a heap limit higher.

Fran Marzoa
  • 4,293
  • 1
  • 37
  • 53
0

OOM in most cases is not with loading bitmaps or like this but mostly its base on GPU Read this link and this one too just look at this solution for various situation caused by OOM

Here in my case i have replace image drawables which is trying to loading from you can use drawable-nodpi

In my app, had drawable-hdpi have all the images for the app. On most devices,no issue . On the S3, the app would take 2x as much memory and then run into out of memory issue.

I just created drawable-xhdpi folder with the same contents as drawable-hdpi folder and run it on S3. Immediately noticed the memory footprint was 1/2 and no out of memory issues.

Community
  • 1
  • 1
Ajay Pandya
  • 2,417
  • 4
  • 29
  • 65