ASP.NET core memory issue

Viewed 173

I have ASP.NET core application which uses mongo DB with terabytes of data. Sometimes requests requires quite big amout of memory. The problem is that although process is finished, memory is not freed. Amount of used memory grows up with each request. I reproduced this situation in very simple code below. There is also diagnostic tools' screenshot attached.

[Route("api/[controller]")]
public class ValuesController : Controller
{
    [HttpGet]
    public IEnumerable<string> Get()
    {
        List<string> result = new List<string>();

        for (var i = 0; i < 5000000; ++i)
        {
            result.Add(Guid.NewGuid().ToString());
        }

        var a = result.Take(100).ToList();
        return a;
    }

}

enter image description here

0 Answers
Related