nextcloud / nextcloud/android

Crash when scrolling medias on low-end hardware: OOM in `DiskLruImageCache.getBitmap`

Open
#11,132 2 comments 0 reactions 0 assignees View on GitHub
bug feature: media tab performance: OOM :brain: stable-3.22
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### ⚠️ Before posting ⚠️

- [X] This is a **bug**, not a question or an enhancement.
- [X] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [X] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [X] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).

### Steps to reproduce

1. Launch Nextcloud application
2. Go to the medias tab
3. Scroll quickly

### Expected behaviour

It is expected to load medias.

### Actual behaviour

It can crash (sometimes).

### Android version

6.01

### Device brand and model

SM-T800

### Stock or custom OS?

Stock

### Nextcloud android app version

3.22.3

### Nextcloud server version

25.0.1

### Using a reverse proxy?

I don't know

### Android logs

### Cause of error
```java
Exception in thread "AsyncTask #5" java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: Exception in thread "AsyncTask #5" java.lang.OutOfMemoryError: Failed to allocate a 36578316 byte allocation with 16769728 free bytes and 28MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:882)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:858)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:896)
at com.owncloud.android.ui.adapter.DiskLruImageCache.getBitmap(DiskLruImageCache.java:169)
at com.owncloud.android.datamodel.ThumbnailsCacheManager.getBitmapFromDiskCache(ThumbnailsCacheManager.java:250)
at com.owncloud.android.datamodel.ThumbnailsCacheManager$GalleryImageGenerationTask.doInBackground(ThumbnailsCacheManager.java:318)
at com.owncloud.android.datamodel.ThumbnailsCacheManager$GalleryImageGenerationTask.doInBackground(ThumbnailsCacheManager.java:274)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

```

### App information
* ID: `com.nextcloud.client`
* Version: `30220390`
* Build flavor: `gplay`

### Device information
* Brand: `samsung`
* Device: `chagallwifi`
* Model: `SM-T800`
* Id: `MMB29K`
* Product: `chagallwifizs`

### Firmware
* SDK: `23`
* Release: `6.0.1`
* Incremental: `T800ZSU1CQB3`

### Server error logs

_No response_

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.