Possible Memory Leak?

Forums 💬 NodeCanvas ⚙️ Support Possible Memory Leak?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #19336
    cmcdonald
    Participant

      Hey there,

      I’ve got 20 agents in my scene (just for reference) and in the profiler it is saying that on an average frame, I’m generating 146KB of GC Alloc every frame coming from BehaviourTree.OnGraphUpdate(). The AI that I’ve created isn’t overly complex, about 5% of what I want the final AI to be capable of.

      As you can imagine this is pretty heavy, about 20ms on the CPU which I definitely cannot have. I also let the game play in the editor for a few minutes and it had maxed out my 32GB of ram. (I’m in Unity 5 Beta 18)

      I wanted to check to see if anyone else is experiencing this problem? Or if it was a bug that needed to be reported.

      Thanks.

      #19344
      cmcdonald
      Participant

        And just another thing to note, if I double the amount of agents the GC Alloc doubles as well.

        #19343
        cmcdonald
        Participant

          I’ve narrowed it down to “Array.Resize()” as you can see in the attached image of a deep profile. This is with 10 agents, hence the 60-70KB of GB Alloc instead of the higher numbers mentioned above.

          Does anyone know what is causing this or how to avoid it?

          #19342
          Gavalakis
          Keymaster

            Hello,

            This is definetely wrong in my part, or in other words it’s a bug :).
            I’ve tracked down the issue and is basicaly because of the CheckField. It also happens on CheckProperty.
            Please give me an email and I will send to you the fixed files once I’ve fixed it tomorrow first thing.

            Thanks a lot for posting it and the details provided.

            Cheers!

            #19341
            cmcdonald
            Participant

              Got a bit further on this, I was using a lot of Get/Set fields using reflection and I found another thread on here that said that was a bad idea:

              http://nodecanvas.com/forums/topic/check-field-has-huge-performance-hit/

              I switched them all to properties and it definitely is better, about 30% better in terms of GC Alloc. But I’m still generating hundreds of KB every frame.

              #19340
              cmcdonald
              Participant

                I seemed to have missed your message! Thanks so much for the prompt reply 🙂

                I’ve sent you an email to your info email listed in the footer of the site.

                #19339
                Gavalakis
                Keymaster

                  Thanks.
                  I’ve send you an email with the fix 🙂

                  Cheers

                  #19338
                  cmcdonald
                  Participant

                    Fix worked! GC Alloc improved over 90%

                    #19337
                    Gavalakis
                    Keymaster

                      I’m glad the fix worked.
                      Thanks for letting us know 🙂
                      The fix will be implemented in the next version.

                      Cheers!

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • You must be logged in to reply to this topic.