Skip to content

.NET 7 RC1 ASP.Net Core Output Caching: Memory leak in MemoryOutputCacheStore? #44169

@jerhon

Description

@jerhon

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I'm trying out Output Caching in RC1. Really awesome functionality and looking forward to using it after RTM.

Looking through MemoryOutputCacheStore.cs I noticed the Dictionary to map the Tags to its individual entries does not clear keys from the dictionary (_taggedEntries) if a cache entry is evicted from the IMemoryCache due to timeout. Is that by design? Is there the potential for a memory leak there for tags with a large number of associated keys?

See the source here:

https://github.com/dotnet/aspnetcore/blob/v7.0.0-rc.1.22427.2/src/Middleware/OutputCaching/src/Memory/MemoryOutputCacheStore.cs

Expected Behavior

I would expect that the keys references in the Dictionary to be cleaned up if an entry it references is evicted from the cache. If this is expected behavior or by design, please just close my issue.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

7.0.100-rc.1.22431.12

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewares

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions