internal void Release(ArrayPool <RpcValue> rpcValueArrayPool , ObjectPool <RpcValue> rpcValuePool) { switch (ValueType) { case ValueType.Byte: case ValueType.Short: case ValueType.Int: case ValueType.Long: case ValueType.Float: case ValueType.Double: MDebug.Assert(ArrayValue == null , "Rpc" , "ArrayValue == null"); break; case ValueType.FixedValueTypeArray: case ValueType.VariableValueTypeArray: int startPoint = ArrayValue.GetOffset(); int endPoint = startPoint + ArrayValue.GetSize(); RpcValue[] elements = ArrayValue.GetBuffer(); for (int iElement = startPoint; iElement < endPoint; iElement++) { RpcValue iterElement = elements[iElement]; iterElement.Release(rpcValueArrayPool, rpcValuePool); rpcValuePool.Release(iterElement); elements[iElement] = null; } rpcValueArrayPool.ReleaseBuffer(ArrayValue); ArrayValue = null; break; default: throw new Exception("Not support ValueType: " + ValueType); } }
public void ReleaseRpcValue(RpcValue rpcValue) { rpcValue.Release(RpcValueArrayPool, RpcValuePool); RpcValuePool.Release(rpcValue); }