Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default value of isLowMemoryDevice #2650

Closed
Errryx opened this issue Nov 29, 2017 · 1 comment
Closed

Default value of isLowMemoryDevice #2650

Errryx opened this issue Nov 29, 2017 · 1 comment

Comments

@Errryx
Copy link

Errryx commented Nov 29, 2017

Glide Version:4.2.0

Integration libraries:OkHttp3

Device/Android Version:Galaxy J1 mini 4.1.1

Issue details / Repro steps / Use case background:
MemorySizeCalculator#isLowMemoryDevice will return FALSE on device with android os < KITKAT,
which means some low-end devices will use maxSizeMultiplier instead of lowMemoryMaxSizeMultiplier when calculate maxSize and could more possibly to produce OOM error on such devices. Maybe it will be better if this method returns true for these cases or more accurately, the return value should depends on the total memory size.

ref:https://github.com/bumptech/glide/blob/master/library/src/main/java/com/bumptech/glide/load/engine/cache/MemorySizeCalculator.java

Glide load line / GlideModule (if any) / list Adapter code (if any):

new MemorySizeCalculator.Builder(CommonUtilsEnv.getInstance().getApplicationContext())
                .setMaxSizeMultiplier(0.2f)
                .setLowMemoryMaxSizeMultiplier(0.15f)
                .build();

Layout XML:
N/A

Stack trace / LogCat:

Fatal Exception: java.lang.OutOfMemoryError
       at android.graphics.Bitmap.nativeCreate(Bitmap.java)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:928)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:901)
       at android.graphics.Bitmap.createBitmap(Bitmap.java:868)
@sjudd
Copy link
Collaborator

sjudd commented Nov 30, 2017

Sure I'm not opposed to setting it to true by default. Would you mind sending a pull request?

Errryx pushed a commit to Errryx/glide that referenced this issue Dec 4, 2017
@Errryx Errryx mentioned this issue Dec 4, 2017
@sjudd sjudd closed this as completed in b221d4b Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants