I am exploring a simple ELF binary with gdb on my machine right now. If I see correctly, all environment variables are loaded into the stack of the process.
I am assuming that they are provided to user applications in case they are needed by the developer or some libc function (e.g. execve).
However, is it not a little bit of an overhead and memory waste for the operating system to copy all of them in every process' memory space, if only a couple of applications really need them? Is there maybe another reason I did not think of?