Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Crazy Spikes in gamemode (profiler screenshot inside)

Discussion in 'Editor & General Support' started by QbAnYtO, Feb 21, 2022.

  1. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    222
    Can someone point me in the right direction on how to handle these spikes? gets worse gradually. is this a memory leak? Starts smooth then every 5 seconds it freezes for 1 second. than after a bit, it freezes every 3 seconds. basically unplayable.

    Unity 2021.2.5f1 spikes.png
     
  2. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    222
    Bumpity bump?
     
  3. danhayesgamer

    danhayesgamer

    Joined:
    Nov 17, 2013
    Posts:
    6
    Looks like you've got some massive gc allocs going on, so there's a big lag spike everytime it needs to empty garbage, which is often if you have a lot of allocs. Hit deep profile and call stacks to see what's causing it. In Timeline view, zoom all the way in and look for the magenta GC alloc blocks. :)

    Are you doing any crazy string operations/concatenation in an update function or anything? Another culprit for big gc allocs is a ui canvas that hasn't been setup properly for animated or constantly updating elements.
     
    QbAnYtO likes this.
  4. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    222
    Oh man Still learning these words and terminologies lol

    I don't have any strings nor ui yet to be honest.

    I click on deep profile and zoomed into the magenta. here are my screenshots.
    How can I pinpoint what is causing this leak? what asset or object?
     

    Attached Files:

  5. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    222
  6. Skiriki

    Skiriki

    Joined:
    Aug 30, 2013
    Posts:
    68
    What is the thread name for that shows the GC Allocs in them? Is this a Scripting thread that you or some plugin you are using started? Have you tried adding ProfilerMarkers to your scripting threads?