Search Unity

Fatal Error: Could not allocate memory: MemoryLabel" DynamicArray

Discussion in 'Editor & General Support' started by DigitalMaster37, Mar 26, 2017.

  1. DigitalMaster37

    DigitalMaster37

    Joined:
    Jun 5, 2013
    Posts:
    5
    Hello everyone.

    Using Unity version [5.5.2f1]
    I recently ran into this issue and I have a question. I've recently made some wide sweeping changes to my code. However, the build prior to this one doesn't run into this issue, so I assume the problem lies within my code.

    When loading a scene, I get the following error below. When I don't get the error, it takes ages for the scene to load. In addition it seems I'm also losing memory on my machine.

    My question is for confirmation of the nature of the error.

    - It says memorylabel is a Dynamic Array. Would this mean something in relation to a list or array datatype in my code? This is my assumption.

    - I have been combing through my changes searching for a problem area (I normally don't make large changes in one session as it is a headache to test - this scenario being a prime example), however I am just hoping to make sure I am accurately searching the code as I attempt to narrow it down to a specific class instance. Your help would be appreciated!

    upload_2017-3-26_10-7-37.png

    Just to add. I took another test (this test didn't produce the error above as I loaded a different scene). What is being loaded during a scene change that would or could possibly take so much space? The changes I've made don't necessitate any increase in objects that I can recall. Please see images

    Before Scene load (scene has only 1 object - created for this test)

    upload_2017-3-26_11-31-55.png

    After Scene load (huge difference)

    upload_2017-3-26_11-32-3.png

    I will add that the last two images AND the ones following are from a test loading to a scene with one object in the scene. As you can see, there is no high script related issues in the images below for this same scene.

    upload_2017-3-26_12-2-29.png

    upload_2017-3-26_12-2-35.png

    Thanks!
     
    Last edited: Mar 26, 2017
  2. DigitalMaster37

    DigitalMaster37

    Joined:
    Jun 5, 2013
    Posts:
    5
    I believe I have narrowed down the error to my code... and I am working through the possible C# scripts that might contain the issue.

    However, if anyone has any thoughts regarding the meaning behind the MemoryLabel: "DynamicArray", that would still be helpful. I will be sure to update the thread once I find the error in case this might be helpful to someone else.

    Thanks
     
  3. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    I'd say this is more a developer-targeted message which, however, clearly says that you are trying to allocate some 2Gb of memory, with 22Gb already in use. DynamicArray is the underlying data structure used for arrays, and it's hard to say which of your code is causing this.
     
    DigitalMaster37 likes this.
  4. PNordlund

    PNordlund

    Joined:
    Nov 20, 2013
    Posts:
    48
    We are getting a similar error on iOS builds randomly - allegedly trying to allocate gigabytes of memory during scene load. I'm pretty sure this is Unity-related as we have nothing that would allocate such memory dynamically.
     
  5. PNordlund

    PNordlund

    Joined:
    Nov 20, 2013
    Posts:
    48
    Here's an example of such crash. I wonder what's on Line:551

    Could not allocate memory: System out of memory!
    Trying to allocate: 30358372352B with 16 alignment. MemoryLabel: DynamicArray
    Allocation happend at: Line:551 in
    Memory overview

    [ ALLOC_DEFAULT ] used: 88188063B | peak: 136172379B | reserved: 93851215B
    [ ALLOC_TEMP_JOB ] used: 0B | peak: 0B | reserved: 262144B
    [ ALLOC_TEMP_BACKGROUND_JOB ] used: 0B | peak: 0B | reserved: 1048576B
    [ IOS new_delete ] used: 0B | peak: 0B | reserved: 0B
    [ ALLOC_GAMEOBJECT ] used: 6458177B | peak: 6474561B | reserved: 6463467B
    [ ALLOC_GFX ] used: 4418885B | peak: 8485077B | reserved: 4437837B
    [ ALLOC_PROFILER ] used: 80B | peak: 80B | reserved: 103B
    [ ALLOC_TEMP_THREAD ] used: 38592B | peak: 0B | reserved: 2588672B
     
  6. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Please submit a bug report.
     
  7. Privateer

    Privateer

    Joined:
    Jun 5, 2016
    Posts:
    23
    I also came to this. Also submitted a bug report. Is there something to do in the meantime? I'm trying to build asset bundles that are quite large all together.
     
  8. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @Privateer please post the case number, and I'll try to get an update for you.
     
  9. mr-bulldops

    mr-bulldops

    Joined:
    Dec 2, 2016
    Posts:
    23
    I'm getting a very similar report that i'm confused on:

    Trying to allocate: 18446744073694350344B with 16 alignment

    Clearly, we don't have an asset that large. I'm running on 2018.2.13f1
     
    Klamore74 likes this.
  10. Klamore74

    Klamore74

    Joined:
    Jun 17, 2013
    Posts:
    103
    Same issue: Trying to allocate: 38985230687B with 16 alignment. MemoryLabel: NewDelete

    Only on some machine: I'm running 2018.2.17f1
     
  11. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    Quick question: are you loading anything from asset bundles? There is a known bug that could lead to this (fix is out or will come out very soon).
     
  12. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    321
    Hello!
    I get a similar error on Oculus Go (Android). I am loading assets from the server. Assets are scenes that I later load in additive mode. The first loading always goes well, and the second leads to this:

    Could not allocate memory: System out of memory!
    Trying to allocate: 503464340B with 16 alignment. MemoryLabel: DynamicArray
     
  13. jcox_PlayQ

    jcox_PlayQ

    Joined:
    Jun 22, 2016
    Posts:
    14
    We're starting to see similar errors once we updated from Unity 5.6 to Unity 2019.1.9.

    Non-fatal Exception: java.lang.Exception: Error : Could not allocate memory: System out of memory!
    Trying to allocate: 18446744072619753546B with 16 alignment. MemoryLabel: String
    Allocation happened at: Line:314 in ./Runtime/Core/Containers/StringStorageDefault.h


    I am quite certain that we are not trying to create any objects that large. We are using asset bundles quite a bit though.
    @Aurimas-Cernius do you have a link to that bug so that we can track its progress?
     
  14. WotC_ChrisE

    WotC_ChrisE

    Joined:
    Sep 18, 2018
    Posts:
    1
    @Aurimas-Cernius I too am interested in knowing more about the bug you mention.
     
  15. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    This bug has been fixed in all supported versions of Unity. It is related to asset bundle loading.
    The issue is a race condition which causes sometimes incorrect data being read, resulting in weird behavior. Such crashes like described in this thread is when garbage is read when reading the size of deserialized array.
     
  16. rskorski-wizards

    rskorski-wizards

    Joined:
    Feb 27, 2018
    Posts:
    8
  17. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    rskorski-wizards likes this.
  18. Mohammadreza55555

    Mohammadreza55555

    Joined:
    Jul 30, 2016
    Posts:
    8
    Still happening in Unity 2021.3.11f1 EDITOR CRASHES WITH OUT OF MEMORY WHILE IMPORTING ASSETS. Memory Label: Dynamic Array.

    When importing, and changing files and folder path from anywhere into the Assets folder in the Unity Editor, and also after deleting the library folder and reopening the project, unity crash with the same crash error.

    So we can't even move our assets in the editor!!!
    One of my coworkers submitted a bug report.

    Unity 2021.3.11f1
    HDRP 12.xx
     
    Eugene-B likes this.