Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.8K
Visualizações
ASP.NET core linux(centos) docker container, what is the mechanism of Garbage Collection?

I have tried to deploy my ASP.NET Core API as a linux docker container on a EC2 CentOS server. Now I'm facing with memory leak issue because my application eating a lot of RAM.

The problem is that when I try to test my API with a number of concurrent requests so my API's RAM usage increase as linear line, but after some period of time it's still grow and not released (seem like the garbage collection is not working).

My API is just simple CRUD API and it only depends on EF core and RabbitMQ client.

When I run the docker image without the memory limit then the RAM usage keep increasing when ever the request come.

MEM USAGE / LIMIT --------- MEM %
890,93 MB/ 15.21 GB --------- 5.xx%

But if I set the Memory limit to 300MB then the ram usage increase to arround 270MB and it reduces to 150MB.

This make me a bit confuse, Is that MEM limit trigger the Garbage Collection to run when RAM usage meet the limit size? Will I also need to set the MEM limit in production ENV?

Here is my DockerFile

FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY "MyAPI.csproj" ./
RUN dotnet restore "MyAPI.csproj"
COPY . .
WORKDIR "/src"
RUN dotnet build "MyAPI.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "MyAPI.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MyAPI.dll"]
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda