✅ High memory consumption issue
Hey!
Scenario:
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
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
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
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() 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()?