Open-event-droidgen: App crashing due to runtime OutOfMemory error

Created on 8 Mar 2017  路  9Comments  路  Source: fossasia/open-event-droidgen

Actual Behaviour
Currently, we are using bitmap in SpeakerDetailsActivity due to which while loading a bitmap the app is raising an OutOfMemory exception at runtime.

screenshot from 2017-03-02 21 59 14

Expected Behaviour
It should be resolved otherwise it will lead to the crash app.

Would you like to work on the issue?
Yes

Most helpful comment

@arp95 @free4murad It is due to the fact that genymotion emulator has less default heap size for apps which is being used for testing. The app might crash in a similar low ram device.

@harshitagupta30 I think a better approach would be to reduce image size before applying than asking for more heap in Manifest , image size can be reduced after Bitmap is ready in Picasso using custom transformer.
That way less memory will be consumed.
Refer this: http://stackoverflow.com/questions/23740307/load-large-images-with-picasso-and-custom-transform-object

All 9 comments

@harshitagupta30 Which activity is exactly causing the issue? Can you provide full stacktrace ?

@betterclever SpeakerDetailActivity is using bitmap to load the images. This is the complete stacktrace which was generated and this happened when I was transitioning to Speaker's Detail.

@harshitagupta30
I didn't face the issue.
what device are you using?

@harshitagupta30
this is device specific i think. I didnt face the issue.

@arp95 @free4murad It is due to the fact that genymotion emulator has less default heap size for apps which is being used for testing. The app might crash in a similar low ram device.

@harshitagupta30 I think a better approach would be to reduce image size before applying than asking for more heap in Manifest , image size can be reduced after Bitmap is ready in Picasso using custom transformer.
That way less memory will be consumed.
Refer this: http://stackoverflow.com/questions/23740307/load-large-images-with-picasso-and-custom-transform-object

@betterclever The ram size of the emulator is currently 2 GB which I think is sufficient enough. Also, as far as I know we are using bitmap images only in some case where we need to draw the Speaker's image not when downloading an image. Still, I'll try to solve it in the way described in link. Thanks for the suggestion. :+1:

@harshitagupta30 It doesn't depend on RAM size but heap size of emulator. Check build.prop of emulator for that. If your emulator has less heap, then it will crash irrespective of RAM size. I faced a similar issue on my app once. Stock emulator provides option to change heap size, AFAIK genymotion doesn't.

Secondly, we are using Bitmap there to dynamically get accentColor from the image using the Palette Class from Support Design Library, which needs to use the Bitmap resource to extract color. Scaling down should optimize it. 馃憤

@betterclever Thanks! I was not aware of this. :clap: :+1:

@harshitagupta30 following suggestions on #1264, scaling down on phone won't be required. This may be left therefore.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mahikaw picture mahikaw  路  7Comments

iamareebjamal picture iamareebjamal  路  7Comments

iamareebjamal picture iamareebjamal  路  8Comments

Shailesh351 picture Shailesh351  路  6Comments

97k picture 97k  路  5Comments