09 2023 档案
摘要:ArrayPool是个数组缓冲池,可重复使用,避免频繁的创建和销毁数组,减少CG,提高性能 需要注意的是,ArrayPool.Shared只支持最大1024*1024长度的数组,如果你申请的数组的长度大于1M,就需要用ArrayPool.Create传入指定的长度支持 byte[] data = n
阅读全文
摘要:/// <summary> /// 信号量,类似于占坑机制,初始设为5个空的坑位,且最大5个位置 /// </summary> static readonly Semaphore semaphore = new Semaphore(5, 5); static void Test() { Task.R
阅读全文