Search Unity

Question NativeArray is not Dispose, computer RAM is always filling up

Discussion in 'Unity Transport' started by Farshadfarzan368, Sep 4, 2023.

  1. Farshadfarzan368

    Farshadfarzan368

    Joined:
    Sep 10, 2022
    Posts:
    73
    Code (CSharp):
    1.   public void SendFragmentedDatatoClient(byte[] bn, NetworkConnection nc)
    2.     {
    3.         if (m_serverDrive.BeginSend(_fragmentedPipeline, nc, out var senddata) == 0)
    4.         {
    5.             NativeArray<byte> nb = new NativeArray<byte>(bn, Allocator.Temp);
    6.             senddata.WriteInt(bn.Length);
    7.             senddata.WriteBytes(nb);
    8.             m_serverDrive.EndSend(senddata);
    9.             nb.Dispose();
    10.         }
    11.     }
    in SendFragmentedData, NativeArray is not Dispose, computer RAM is always filling up