question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ASP.NET Core 2.2 memory leak

See original GitHub issue

Hello 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

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
travisjscommented, Jan 26, 2019

@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

2reactions
kameleon71commented, Dec 18, 2018

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 😉

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found