Skip to content

Memory leak in blazor server application .net 7 #80258

@alanma75

Description

@alanma75

Description

as planned .net 7 upgrade on our existing blazor projects, we noticed memory usage on performance test increased drastically, with dockerized container we can drive the application to OOM exception.
reproduced and profiled locally, it shows the top locking objects are ConcurrentDictionary+Tables<JsonSerializerOptions, WeakReference<JsonSerializerOptions+CachingContext>>
#76548 - this issue was already reported in November 2022.

this is blocking us from upgrading an important application in production to .net 7. I have attached the sample project to demonstrate the OOM exception, with GCHeapHardLimit set to 1GB, 10+ webpage reload of blazor application will get OOM exception.

Reproduction Steps

Launch blazor server application attached, open http://localhost:5000 to load the sample application, refresh the page and observe the memory increasing with Generation2 stack and not be able to free after GC.

using the HeapHardLimit value in the sample (1GB), observe OOM exception in about 10 reloads

Expected behavior

Memory properly GCed

Actual behavior

OOM exception occurs

Regression?

this is new in .net 7 with the C

Known Workarounds

no workarounds

Configuration

.net 7
it happens in all OS
telerikgridhorscrollingapp.zip

Other information

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions