ASP.NET Core 2.2 memory leak
See original GitHub issueHello all, I found memory leak when I sent files to API using IFormFile interface. With version 2.1 everything is ok.
Simple example: Content-type: multipart/form-data
controller
[ApiController]
public class FormController : ControllerBase
{
[HttpPost]
[Route("[controller]/Insert")]
public async Task<IActionResult> Insert([FromForm] Form form)
{
return Ok();
}
}
viewmodel
public class Form
{
public string Name { get; set; }
public IFormFile File { get; set; }
public ICollection<DynamicInput> Inputs { get;set; }
}
public class DynamicInput
{
public string Name { get; set; }
public IFormFile File { get; set; }
}
process dotnet.exe
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Why ASP Net Core 2.2 do not release memory?
ASP.NET Core can appear to use more memory than it should because it's configured to use Server GC by default (as opposed to...
Read more >Memory management and patterns in ASP.NET Core
If the Task Manager memory value increases indefinitely and never flattens out, the app has a memory leak. The following sections demonstrate ...
Read more >Memory Leak in new ASPNET 2.2 routing? · Issue #6102
As dotnet.exe consumes memory, there appears to be a few threads that pop off coreclr_shutdown . Not much to discern, but worth noting....
Read more >Do I have a memory leak in my ASP.NET Core 2.2 ...
In time the application seems like doesn't release any memory and everytime when I refresh some page the memory usage goes up and...
Read more >Troubleshooting high memory usage with ASP.NET Core ...
Some typical reasons for memory leaks can be if you are not using a disposable object in a using block, or if you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@davidfowl
This seams to be caused by the following method being called when an array of IFormFiles has to be parsed by the ModelBinder. It does a loop with an upper range of int.MaxValue
https://github.com/aspnet/AspNetCore/blob/1aa50faa290ecda304507981cd01ed92651d5e34/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/CollectionModelBinder.cs#L310-L324
Here you are: https://github.com/kameleon71/asp.net.core.2.2.memory.leak This example is based on template asp.net.core web app in VS2017 (angular client) Just run, click fetch data and watch memory usage 😉