Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.8K
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda