Search Issue Tracker

By Design

Votes

1

Found in

2021.3.33f1

2022.3.14f1

2023.2.2f1

2023.3.0a16

6000.0.0b11

Issue ID

UUM-57096

Regression

No

[Android] Crashes on MemoryManager::OutOfMemoryError when loading a scene on Android

-

Reproduction steps:
1. Open the attached Project “ReproProject1”
2. Build And Run on Android
3. Select the “LoadScene Scenes/town_prairietown” Button
4 Observe the app’s behavior

Expected result: The scene loads successfully
Actual result: The app crashes

Reproducible with: 2021.3.33f1, 2022.3.14f1, 2023.2.2f1, 2023.3.0a16

Reproducible with these devices:
VLNQA00518 - Google Pixel 4 (Pixel 4), CPU: Snapdragon 855 SM8150, GPU: Adreno 640, OS: 12
VLNQA00414 - Galaxy Note10+ 5G (SM-N976V), CPU: Snapdragon 855 SM8150, GPU: Adreno 640, OS: 9
VLNQA00278 - Xiaomi Redmi Note 7 (Redmi Note 7), CPU: Snapdragon 660, GPU: Adreno 512, OS: 9.0.0
VLNQA00139 - Vivo Xplay6 (vivo Xplay6), CPU: Snapdragon 820 MSM8996, GPU: Adreno 530, OS: 7.1.1
VLNQA00132 - Xiaomi Mi 5s (MI 5s), CPU: Snapdragon 820 MSM8996, GPU: Adreno 530, OS: 6.0.1

Testing environment: macOS(Intel) 14.0 Sonoma

First few lines of stack trace:
#01 pc 011cf7d7 /data/app/com.x.Demo--3wPD2GovELn3GpLRrD0Ag==/lib/arm/libunity.so (DebugStringToFilePostprocessedStacktrace(DebugStringToFileData const&)+810)
#02 pc 011cfb2b /data/app/com.x.Demo--3wPD2GovELn3GpLRrD0Ag==/lib/arm/libunity.so (DebugStringToFile(DebugStringToFileData const&)+502)
#03 pc 002fc273 /data/app/com.x.Demo--3wPD2GovELn3GpLRrD0Ag==/lib/arm/libunity.so (MemoryManager::OutOfMemoryError(unsigned int, unsigned int, MemLabelId const&, char const*, int)+434)
#04 pc 002f94d9 /data/app/com.x.Demo--3wPD2GovELn3GpLRrD0Ag==/lib/arm/libunity.so (MemoryManager::Allocate(unsigned int, unsigned int, MemLabelId const&, AllocateOptions, char const*, int)+356)

Notes:
1. The crash does not reproduce when the “Standard” shader is removed from the project.
2. The build fails on IOS, seems like some of the textures in the Project are in a format that is not supported on iOS.

  1. Resolution Note:

    The Standard shader has been found in the "always included shader" list (in the project graphic settings).
    That generates a large number of shader variants (>500k on Android) that on mobile at runtime saturates the memory.
    In the unity manual, there is a warning to not do that for the standard shader : "Warning: This feature is not recommended for shaders that have a large number of variants, such as the Standard Shader; it can lead to significant runtime and build time performance problems. You should instead create shader variant collections that contain only the variants you need, and include those in your build".
    That is not an Android-specific behavior but happens across all the supported platforms.
    The issue disappears if the Standard shader is removed from the "always included shader" list.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.