I’m on a M2 Macbook Pro using the Dev Container setup. Memory usage seems really high, is this typical? I see about 4GB memory usage before running anything, then needing about 10GB to get through a successful build and the full app running at about 8GB.
AI-generated summary
High Memory Usage in Dev Container: dsims is experiencing high memory usage with the official Dev Container setup, with 4GB usage at rest and up to 10GB during a build. In comparison, their custom devcontainer.json setup uses only 2GB RAM at rest and 6GB while running Discourse. The official image uses a base image with several features, including apt-packages, ruby, node, rust, redis-server, go, and go-packages-install. jahan_gagan notes that the official image bundles everything needed to run Discourse, resulting in higher memory requirements. dsims asks if others are seeing similar memory usage, and later updates that the usage has decreased to around 6GB after restarting, which they consider “typical”. Any further increases are attributed to a possible memory leak in the dev stack or Docker Desktop.
Before the official Dev Container config was shared, I had my own devcontainer.json that didn’t use the discourse_dev base image. It uses only 2GB RAM at rest and 6GB while running Discourse, so I’m curious what the difference could be.
base image: mcr.microsoft.com/devcontainers/base:debian-12
with these “features”:
"features": {
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "software-properties-common libpq-dev vim curl expect debconf-utils build-essential zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libreadline6-dev libpcre3 libpcre3-dev imagemagick advancecomp jhead jpegoptim libjpeg-turbo-progs optipng pngcrush pngquant gnupg2"
},
"ghcr.io/devcontainers/features/ruby:1": {
"version": "3.3.4"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "18",
"pnpmVersion": "9"
},
"ghcr.io/devcontainers/features/rust:1": {
"version": "1.75.0"
},
"ghcr.io/itsmechlark/features/redis-server:1": {},
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/azutake/devcontainer-features/go-packages-install:0": {
"PACKAGES": "github.com/mailhog/MailHog@latest"
},
},
including another container db service running the postgres:14 image
The official image aims to simplify development by bundling everything needed to run Discourse seamlessly, at the cost of higher memory requirements, and your custom setup seems to have a fine-grained control over versions and installed libraries.
Are you also seeing the dev image using about 8-10GB RAM?
Now it’s down around 6GB after restarting all the things, so I am going to assume that is “typical” and blame any more than that on a possible memory leak somewhere in the dev stack (probably Docker Desktop).