© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•5mo ago•
25 replies
qqdev

✅ High memory consumption issue

Hey!

Scenario:

- Loop
- Download a blob (zip file) from an Azure Blob Storage container (download file size: 5mb max.) (via a stream which gets disposed)
- Unzip the zip file (unzipped file size: 50mb max.) (via a stream which gets diposed)
- Deserialize the file content (JSON) (via a stream which gets disposed)
- Do sth with the deserialized data

Observation:

We noticed that this loop leads to a high memory consumption. This is fine per se but the memory usage is not really going down to a reasonable level. Even after several hours. First guess: We are missing some
Dispose()
Dispose()
calls. Wasn't able to find any missing ones. Even used 3rd party Roslyn analyzers. Nothing. Interesting other fact: The memory usage stays quite high but it does not look like a leak because it's not really growing over time. It just stays at the high level.

I also profiled the scenario with dotMemory: It's a lot of unmanaged memory which is causing the issue.

What does help? The GC is being triggered when taking a memory snapshot which leads to a lot of the unmanaged memory to be released.

Actual question:

Are we doing sth wrong or can this be just normal behavior? Is this a valid case for calling
GC.Collect()
GC.Collect()
?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,828Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Weird memory consumption on linux
C#CC# / help
3y ago
❔ High Unmanaged Memory
C#CC# / help
4y ago
weird memory consumption vs machine spec
C#CC# / help
13mo ago