static memoryPool() { pools = dictionary.CreateInt <memoryPool>(); pools.Add(unmanagedStreamBase.DefaultLength, TinyBuffers = new memoryPool(unmanagedStreamBase.DefaultLength)); pools.Add(config.appSetting.StreamBufferSize, StreamBuffers = new memoryPool(config.appSetting.StreamBufferSize)); if (fastCSharp.config.appSetting.IsCheckMemory) { checkMemory.Add(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); } }
/// <summary> /// 获取匹配值集合 /// </summary> /// <param name="isValue">数据匹配器</param> /// <returns>匹配值集合</returns> public unsafe valueType[] GetFindArray(Func <valueType, bool> isValue) { if (isValue == null) { log.Error.Throw(log.exceptionType.Null); } if (this.length != 0) { int length = ((this.length + 31) >> 5) << 2; memoryPool pool = fastCSharp.memoryPool.GetDefaultPool(length); byte[] data = pool.Get(length); try { fixed(byte *dataFixed = data) { System.Array.Clear(data, 0, length); return(getFindArray(isValue, new fixedMap(dataFixed))); } } finally { pool.PushNotNull(data); } } return(nullValue <valueType> .Array); }
/// <summary> /// 缓冲数组子串 /// </summary> /// <param name="value">数组子串</param> /// <param name="pushPool">数组子串入池处理</param> public pushSubArray(subArray <byte> value, memoryPool pushPool) { Value = value; this.PushPool = pushPool; }