Out of Memory when browsing photos in large folder
- 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. Have large folder (12k photos and videos, 40gb)
2. scroll through
3. open a few photos, then go back keep scrolling
4. repeat 3-4 times
5. Out of memory exception
### Expected behaviour
Even though its quite a tough situation with such a big folder, the app should make it work without throwing a hard OOM error. Like free up memory from previously watched content.
### Actual behaviour
### Cause of error
```java
Exception in thread "Thread-42" java.lang.OutOfMemoryError: Failed to allocate a 52696 byte allocation with 1436800 free bytes and 1403KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC.
at org.apache.jackrabbit.webdav.MultiStatus.getResponses(MultiStatus.java:128)
at com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation.readData(ReadFolderRemoteOperation.java:131)
at com.owncloud.android.lib.resources.files.ReadFolderRemoteOperation.run(ReadFolderRemoteOperation.java:70)
at com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:193)
at com.owncloud.android.operations.RefreshFolderOperation.fetchAndSyncRemoteFolder(RefreshFolderOperation.java:460)
at com.owncloud.android.operations.RefreshFolderOperation.run(RefreshFolderOperation.java:275)
at com.owncloud.android.lib.common.operations.RemoteOperation.run(RemoteOperation.java:387)
at java.lang.Thread.run(Thread.java:1563)
```
### App information
* ID: `com.nextcloud.client`
* Version: `340000090`
* Build flavor: `generic`
### Device information
* Brand: `google`
* Device: `tegu`
* Model: `Pixel 9a`
* Id: `BP4A.260205.001`
* Product: `tegu`
### Firmware
* SDK: `36`
* Release: `16`
* Incremental: `2026060601`
### Android version
16
### Device brand and model
Google Pixel9a
### Stock or custom OS?
Custom (explain in "additional information")
### Nextcloud android app version
34.0.0
### Nextcloud server version
Nextcloud Hub 25
### Using a reverse proxy?
I don't know
### Android logs
_No response_
### Server error logs
```bash
```
### Additional information
Smartphone OS GrapheneOS
Nextcloud server by Hetzner storageshare
Contributor guide
Assessment
This issue has not been assessed yet.