Search Unity

Bug (Case 1396199) NetworkDriver.BeginSend() and EndSend() generates GC

Discussion in 'Unity Transport' started by Kichang-Kim, Jan 19, 2022.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,012
    Hi. I found that NetworkDriver.BeginSend() and EndSend() generates GC. Both Editor and IL2CPP player.

    You can easily reproduce it by implementing local send/receive code.

    Reported as Case 1396199.
     
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    This is likely caused by our use of Burst function pointers in these methods. When called from managed code, they end up generating GC. We're aware of the issue and are looking into solutions to address this.

    In the meantime, our recommendation to avoid the GC is to call these methods from a Burst-compiled job. I understand this might not be the most practical solution for everyone, which is why we're working on solutions to make these methods avoid GC when called from managed code.
     
    Kichang-Kim likes this.
  3. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,012
    I confirmed that burstify Begin/EndSend() makes GC disappeared. Thanks.