You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DefaultPartitionedRateLimiter never disposes NoopLimiter #124557
DefaultPartitionedRateLimiter never disposes NoopLimiter leading to memory leak and increased CPU usage as it performs its internal work on list of all limiters every 100ms.
There is logic inside Hearbeat() to dispose limiters after some idle period but condition is never true for NoopLimiter.
Run this application with debugger in Visual Studio:
usingSystem.Threading.RateLimiting;PartitionedRateLimiter<string>limiter=PartitionedRateLimiter.Create<string,string>(x =>{returnRateLimitPartition.GetNoLimiter(x);});while(true){Console.WriteLine("Press any key to generate limiters...");Console.ReadLine();foreach(variteminEnumerable.Range(0,100_000)){_=awaitlimiter.AcquireAsync(Guid.NewGuid().ToString());}}
Take memory snapshots and observe limiters are created but never disposed.
This would be a problem for any limiter that reports "IdleDuration == null". One solution is to track the last access (tick) and fallback to checking it if IdleDuration provides no information.
Activity
dotnet-policy-service commentedon Feb 18, 2026
Tagging subscribers to this area: @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.
VSadov commentedon Apr 29, 2026
This would be a problem for any limiter that reports "IdleDuration == null". One solution is to track the last access (tick) and fallback to checking it if IdleDuration provides no information.