Search Issue Tracker

By Design

Votes

1

Found in

2019.4

2020.2.2f1

2020.3

2021.1

2021.2

Issue ID

1311584

Regression

No

[Android] Memory fragmentation occurring upon loading a Scene

Mobile

-

Reproduction steps:
1. Open the attached user's project "GoliathFromScratch.zip"
2. Switch to Android Platform
3. Open Android Logcat and switch to its Memory Profiler (Tools > Memory Window > Auto Capture)
4. Build for Android
5. Upon the App launch observe memory allocations while switching from "MainMenu" Scene and "Game" Scene with a button press
6. Note that the "PrivateOther" section grows significantly

Expected result: memory allocations are around 200MB
Actual result: memory allocations are around 600MB (see attached Results.png)

Reproduces on: 2019.4.24f1, 2020.3.4f1, 2021.1.2f1, 2021.2.0a12
Could not test on 2018.4.33f1 due to the project breaking when downgrading

Reproducible with these devices (Vulkan, OpenGLES 3, OpenGLES 2):
N/A, Samsung Galaxy S9 (SM-G960F), Android 8.0.0, CPU: Exynos 9 Series 9810, GPU: Mali-G72
VLNQA00316, Samsung Galaxy Note10 (SM-N970F), Android 9, CPU: Exynos 9 Series 9825, GPU: Mali-G76
VLNQA00024, Xiaomi Mi 5 (MI 5), Android 7.0, CPU: Snapdragon 820 MSM8996, GPU: Adreno (TM) 530
VLNQA00231, Huawei HUAWEI Mate 20 Pro (LYA-L29), Android 9, CPU: HiSilicon Kirin 980, GPU: Mali-G76

Could not test due to Android Logcat disconnecting whenever trying to look up the memory allocations:
VLNQA00318, Oneplus 7Pro (GM1913), Android 10, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640

  1. Resolution Note (2022.1.X):

    Tried the project on few devices with very different results:
    - Galaxy Fold 2 - over 600MB
    - Asus ROG Phone - a bit over 300MB
    - Nokia 7 Plus - around 300MB
    - iPhone X - over 500MB
    - iPhone 6s - around 250MB

    Unity memory usage should be jugged by Unity profiler, not by adb/xcode. The pattern above indicates, that memory usage highly depends on how powerful the device is and on the weakest device the figure is around the expected value. On mobile phones you can see apps using a lot of memory with OS not reclaiming it when there is lots of memory available and not required by other tasks. Sending app to background and launching something else that requires memory might reduce the usage.
    It seems that you are looking for memory problems at a wrong place. Crash due to out of memory should be because of a lot of memory used by Unity and it should be visible in Unity profiler (unless you use some native plugins and allocate native on their own).

Add comment

Log in to post comment