VSCode Docker devcontainer using way more RAM than an equal one

23 Views Asked by At

I have a git repository containing the setup for a devcontainer to be run on Docker with WSL2 integration, opening this repo in VSCode will setup a Debian 11 container on Docker Desktop, download the content of 3 other repos conaining C++ code inside it and configure VSCode with all the needed extensions to be able to build the project.

Now I'm facing quite a strange issue.

I downloaded the same devcontainer in two separate folders, opening them with separate instances of VSCode correctly creates 2 different containers which (to my understanding) should be functionally equal.

The problem arises when I try to compile the code inside with GCC (10.2.1) on both of them (not at the same time), on one container everything compiles fine and Docker shows it using no more than 8 cores and ~8GB of RAM max. On the other Docker reports the container using 20 cores and the full 15GB of RAM usable by Docker, the compiler then crashes with

g++: fatal error: Killed signal terminated program cc1plus

I suspect because it has ran out of RAM.

What could cause this behaviour?

Of course I could just discard the "defective" container and use the one that is working as expected but it would be nice to have an idea of what is happening should it occur again in the future.

0

There are 0 best solutions below