-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: Items are not being evicted from MemoryCache in .NET 6 #74676
Comments
Tagging subscribers to this area: @dotnet/area-extensions-caching Issue DetailsDescriptionThis works in .NET Framework, but in .NET 6, I'm seeing an issue where items added to a Likely related, no matter how much I add to the cache, Reproduction StepsRun the code below, and notice that items are never evicted from the cache, and that the result of
Expected behavior
Actual behaviorIn .NET 6, items are not evicted from the cache, and the result of Regression?Yes, this worked as expected in .NET Framework. Known WorkaroundsNo response ConfigurationRunning .NET 6.0.8 on Windows 10.0.19044.0 (x64) Other informationNo response
|
This may tie in with #62516 which has been labeled as a documentation issue. I know there are some features of MemoryCache from Framework that don't work on Core... but I thought MemoryCache.GetLastSize() was supposed to be non-zero here. I think this probably warrants a closer look. |
MemoryCache.GetLastSize() calls MemoryCacheStatistics.GetLastSize(), which reads MemoryMonitor.PressureLast, which reads runtime/src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/SRef.cs Lines 13 to 26 in 9295993
|
This depends on some solution being implemented for #24200 |
Description
This works in .NET Framework, but in .NET 6, I'm seeing an issue where items added to a
MemoryCache
are not evicted based on the cache memory limit.Likely related, no matter how much I add to the cache,
MemoryCache.GetLastSize()
always returns0
in .NET 6.Reproduction Steps
Run the code below, and notice that items are never evicted from the cache, and that the result of
GetLastSize()
is always0
.Expected behavior
GetLastSize()
is non-zero.Actual behavior
In .NET 6, items are not evicted from the cache, and the result of
GetLastSize()
is always zero.Regression?
Yes, this worked as expected in .NET Framework.
Known Workarounds
No response
Configuration
Running .NET 6.0.8 on Windows 10.0.19044.0 (x64)
Other information
No response
The text was updated successfully, but these errors were encountered: