Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[AssetBundles][AUP][Textures] JobTempAlloc has allocations that are more than 4 frames old

Discussion in 'Asset Bundles' started by poprev-3d, Nov 9, 2019.

  1. poprev-3d

    poprev-3d

    Joined:
    Apr 12, 2019
    Posts:
    69
    Hi everyone,

    Using Unity 2019.2, I encounter a problem loading (at runtime) an AssetBundle containing a 3D model with a texture with crunch compression (50%).

    Every time I load this 3D model at runtime from the asset bundle, I get this message :

    JobTempAlloc has allocations that are more than 4 frames old..

    To Debug, enable the define: TLA_DEBUG_STACK_LEAK in ThreadsafeLinearAllocator.cpp. This will output the callstacks of the leaked allocations

    Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 6)


    How to reproduce :
    -> Create an asset bundle with a 3D model (a simple cube is enough) having a very large texture (+10mb uncompressed, 8K texture, like the one I attached) and use crunch compression at 50%. For the bundle, juste use uncompressed or LZMA settings.
    -> Load the model and place it in the scene with LoadAssetAsync with the following code

    Code (CSharp):
    1. public class TestAssetLoad : MonoBehaviour
    2. {
    3.     public string path = "/path/cube";
    4.  
    5.     void Update()
    6.     {
    7.         if (Input.GetKeyDown(KeyCode.K))
    8.             StartCoroutine(LoadAsset());
    9.     }
    10.  
    11.     public IEnumerator LoadAsset()
    12.     {
    13.         AssetBundleCreateRequest bundleLoadRequest = AssetBundle.LoadFromFileAsync(path);
    14.         yield return bundleLoadRequest;
    15.  
    16.         AssetBundle Bundle = bundleLoadRequest.assetBundle;
    17.  
    18.         if (Bundle == null)
    19.         {
    20.             Debug.Log("Failed to load AssetBundle!");
    21.             yield break;
    22.         }
    23.  
    24.         AssetBundleRequest assetLoadRequest = Bundle.LoadAssetAsync<GameObject>("cube");
    25.         yield return assetLoadRequest;
    26.  
    27.         GameObject prefab = assetLoadRequest.asset as GameObject;
    28.         Instantiate(prefab);
    29.     }
    30. }
    You should see the message. I think this warning is due to the processing of the texture which is done with AUP (Async Upload Pipeline) on jobs that last more than 4 frames (due to the size of the texture), because it would not show up if crunch compression is not activated.

    Any idea ? Is it a bug to be fixed for large textures ?

     
    Last edited: Nov 9, 2019
  2. poprev-3d

    poprev-3d

    Joined:
    Apr 12, 2019
    Posts:
    69
    Up :) the issue also occurs in 2019.3
     
  3. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Sounds like the UAP per frame time slice is not enough to load that texture in less that 4 frames. Did you try increasing the time slice value? Also, are you setting the async upload buffer size to accommodate such large texture beforehand?
     
  4. poprev-3d

    poprev-3d

    Joined:
    Apr 12, 2019
    Posts:
    69

    I set up the async values at their maximum but I'm still getting the issue... :( Any more ideas ? :)
     
  5. masak

    masak

    Joined:
    Aug 14, 2011
    Posts:
    51
    I encountered similar issue.
    unity2019.3.10f1 HDRP Addressable1.8.3
    I loaded an assetbundle that contains huge scene with lots of textures.
    In most case, a build freezed!!!

    I seted async upload buffer size 4 (mb)
    Async upload time slice 33(ms)
    These settings solved this problem.
    But I think that this is a bug.
     
    ryanmillerca likes this.
  6. hmtyzr

    hmtyzr

    Joined:
    Dec 22, 2016
    Posts:
    7
    Thanks @masak. I had the same problem on a very similar setup to yours which includes Addressables package, too. I could finally solve the problem after playing with those settings.

    For those having a similar problem, you can read more on the following links.

    https://blogs.unity3d.com/2018/10/0...ance-understanding-the-async-upload-pipeline/

    https://docs.unity3d.com/ScriptReference/QualitySettings.html
     

    Attached Files:

  7. funselektor

    funselektor

    Joined:
    Oct 11, 2013
    Posts:
    105
    I found that if you limit the framerate cap to something low in the loading screens then this error goes away
    Application.targetFrameRate = 30;
     
    hmtyzr likes this.
  8. masak

    masak

    Joined:
    Aug 14, 2011
    Posts:
    51
    Unity2019.4.0f1 solved the freeze bug. (( Editor shows lots of warning as usual
     
  9. masak

    masak

    Joined:
    Aug 14, 2011
    Posts:
    51
  10. ArshakKroyan

    ArshakKroyan

    Joined:
    Mar 4, 2015
    Posts:
    32
    Hi @masak
    Could you please explain what do you mean saying "freeze bug"?

    We came accross some loading issue. For some devices the loading progress doesn't go more than 95% and stays there forever.
    Is your case the same?
     
  11. masak

    masak

    Joined:
    Aug 14, 2011
    Posts:
    51
    Freeze bug means that app window does not react, and if i click it, windows says that this application is not responding...
    If you click your app after 95% and windows says nothing, I think different case.
     
    ArshakKroyan likes this.