Search Unity

Are constant memory allocations normal?

Discussion in 'Cinemachine' started by frosted, Oct 29, 2021.

  1. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Brain seems to allocate around 1.5k every single frame.

    Is this to be expected or do I have some kind of strange bug ?

    Cinemachine 2.8.0
     
  2. samochreno

    samochreno

    Joined:
    Feb 4, 2021
    Posts:
    14
    Definitely not normal behaviour, at least not from my experience
     
  3. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    You sure? Happens in late update, can you check profiler?
     
  4. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Alright, so I double checked empty project.

    This is empty project. CM 2.8.0

    Problem starts happening depending on look and follow/body aim.


    Unity_mJMnghIYSV.png
    With default settings but lookat and follow assigned, I get 2.6kb per frame every frame.



    Unity_KLb223uEsb.png
    With LookAt cleared and aim composer not doing anything I get 1.2k with 3rd person follow.



    Unity_N6LUT2MVj2.png
    "Do nothing" for both body and aim, but no LookAt assigned 1.2kb



    Unity_JCwV0O4Rnv.png
    Same "do nothing" but I removed the follow - now finally we have 0kb alloc.
     
  5. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    alright, so I dug a little deeper...

    this isn't a cinemachine bug its a core unity bug. Unity_cWOQxHGEOy.png
    GetComponent<> will allocate on abstract or interface..... wtf.

    Unity_4S2Y7IlKb4.png

    Are you kidding me?? How tf did this get past QA?! Lol
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Actually it is a Cinemachine bug. Don't know how that one got out into the field :eek:, we will fix right away.
    Thanks for letting us know <3

    UPDATE: turns out we had already caught and fixed this. Just update your CM version to 2.8.2.
     
    Last edited: Nov 1, 2021
    gaborkb and MartinTilo like this.
  7. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,451
    There is an underlying issue underneath that though. The Null Component Error message is not allocated underneath an AvailabilityEditor, aka EditorOnly flagged ProfilerMarker. That is a regression in how well the Profiler is able to hide the allocation that is meaningless to optimize if your only concern is to get your player's game loop GC free.