Search Issue Tracker

In Progress

Fix In Review for 2022.3.X

Votes

10

Found in

2022.3.25f1

2023.2.18f1

Issue ID

UUM-69949

Regression

No

[Android] The warning "Internal: JobTempAlloc has allocations that are more than the maximum lifespan of 4 frames old - this is not allowed and likely a leak" is displayed when ShaderVariantCollection.WarmUp is called

-

Reproduction steps:
1. Open the attached project “Reproject”
2. Switch Platform for Android (menu: File > Build Settings)
3. Build and Run on Android
4. Observe the Console Window

Expected result: There are no warnings in the logs
Actual result: "Internal: JobTempAlloc has allocations that are more than the maximum lifespan of 4 frames old - this is not allowed and likely a leak" message is logged once, and " Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5)" messages are logged multiple times

Reproducible with: 2022.3.25f1, 2023.2.18f1
Not reproducible with: 6000.0.0b14
Couldn’t test with: 2021.3.37f1 (user’s script errors)

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
VLNQA00591 - Samsung Galaxy S23 (SM-S911B), CPU: Snapdragon 8 Gen 2 (SM8550), GPU: Adreno 740, OS: 14
VLNQA00278 - Xiaomi Redmi Note 7 (Redmi Note 7), CPU: Snapdragon 660, GPU: Adreno 512, OS: 9.0.0
Pixel3XL (Recall 4/10) (user’s)

Not reproducible with these devices:
VLNQA00139 - Vivo Xplay6 (vivo Xplay6), CPU: Snapdragon 820 MSM8996, GPU: Adreno 530, OS: 7.1.1
Pixel 6 Pro (Recall 0/10) (user’s)

Testing environment: Windows 11 23H2 (22631.3007), Windows 11 (10.0.22631) 64bit (user’s)
Not reproducible environment: No other environment tested

Notes:

* The attached project is just a script that executes ShaderVariantCollection.WarmUp added to 3D Sample Scenes (URP)
* Not reproducible on IOS (user’s info)
* Not reproducible when using OpenGLES3

Comments (2)

  1. Doronn89

    Mar 04, 2025 18:33

    This causes us crashes as well.
    I've noticed this ticket is opened for nearly a year with full reproduction steps.
    Can anyone verify a fix or a reliable workaround is coming?

  2. phil_unity445

    Aug 20, 2024 23:23

    I am seeing this issue on the Quest 2 and Pico 4 as well with Unity version 2022.3.35f1 and 2022.3.42f1. It seems to also relate to a potential crash that can occur if you attempt to load a Scene after warming up the shader variant.

    I ran into this with my company's application where we are attempting to load a scene and related shader variant collection from a downloaded assetbundle. However, you can reproduce this crash pretty easily with simple sample project and I also discovered an interesting workaround to this issue that involves iteratively calling "WarmUpProgressively(1)" inside a coroutine and waiting for a frame between each call. While I cannot seem to attach a project via comment, all you really need is a simple script like so:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.SceneManagement;

    public class TestLoader : MonoBehaviour
    {
    [SerializeField]
    private bool _warmProgressive = false;

    // Start is called before the first frame update
    IEnumerator Start()
    {
    yield return new WaitForSeconds(2);

    ShaderVariantCollection shaderVariantCollection =
    Resources.Load<ShaderVariantCollection>("sampleShaderVariants");

    if (_warmProgressive)
    {
    while (!shaderVariantCollection.WarmUpProgressively(1))
    {
    Debug.Log($"Shaders Warmed Up: {shaderVariantCollection.warmedUpVariantCount}");
    yield return null;
    }
    }
    else
    {
    shaderVariantCollection.WarmUp();
    }

    SceneManager.LoadScene("Scenes/SampleScene");
    }

    }

    Where "sampleShaderVariants" is a shader variant collection of non-trivial size in your Resources directory and Scenes/SampleScene is a second scene in that you've built in. I just attach this script to an object in the primary scene in the build. If "_warmProgressive" is set to true everything is fine, but if it is false, I get this JobTempAlloc warning and the app will crash shortly after loading SampleScene.

Add comment

Log in to post comment