Does docker cost more momeries?

  Kiến thức lập trình

I meet some problems about Docker.
I have some c++ codes about the remote sensing image processing(using GDAL and HDF5 Library), which complied in Linux.
In order to improve efficiency, I make a Docker images, which including ubuntu、GDAL、HDF5.But I don’t use the same version g++, the Docker image is the latest gcc,whlie the PC is gcc 7.5.I make an executable files(xxx.out) using the PC and Docker.Everything is ok until I find that the Docker cost much more momeries than the PC.The memory cost by Docker keeps increasing until the program is killed.While the memory occupied by the PC increases to 170 GB and remains there.
I’m not sure what the problem is.I used multithreading.But the PC created 40 threads while Docker only created 20.
So I want to know why this problem occurs? Is anyone else meet the same?
I would really appreciate it if you could answer it.