Score:-2

What can cause a process to use more memory on one OS compared to another?

cn flag

My process uses more memory when executed on Ubuntu 22.04 than when executed on Oracle Linux 8. Is it something to do with the operating system or with the compiled program?

Details:

The process I am running is the one you get when you download Minecraft (Bedrock Edition) from the Minecraft website. In the file downloaded, it's called bedrock_server, and you're instructed to run it with the command LD_LIBRARY_PATH=. ./bedrock_server, so my understanding is that there is at least one dynamically linked file that is loaded from that directory too.

# file bedrock_server
bedrock_server: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[xxHash]=51ffa5a7d5d4a199, stripped

I was originally using a 1 GB VPS running Oracle Linux 8 to run it. While it's running, ps shows the following output:

$ ps aux | head -1; ps aux | sort -rnk 4 | head -1
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      650031 10.9 31.0 2585888 297956 ?      Ssl  03:57  82:47 ./bedrock_server

I wanted to try another VPS provider because I was experiencing too much CPU steal with this one, and I chose a 1 GB VPS on that provider too. I chose Ubuntu 22.04 for its OS. But this time, Minecraft stopped working after a few minutes when memory ran out. And I noticed when investigating that it appears to use more memory on this VPS:

# ps aux | head -1; ps aux | sort -rnk 4 | head -1
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       13620 11.0 60.1 1238576 535844 ?      Rl   15:53   4:39 ./bedrock_server

According to "RSS", it appears to be using about 250 MB more memory.

I've tried to leave everything the same for this comparison. The files for Minecraft that are being executed and used as data for the world, server settings, etc were copied over from the first VPS to the second.

So as far as I can see, the only difference between these VPSs are the OS used. One is Oracle Linux 8 and one is Ubuntu 22.04. I'd like to understand why this is causing the difference in memory used. Or, if it's not what's causing it, what is.

If this question is too open ended to be answered the way I've phrased it, I think an alternative question phrasing could be "How can I investigate why memory usage is higher in one OS than in another?" etc.

uz flag
Did you look at : [Process memory usage on Linux](https://unix.stackexchange.com/questions/429459/process-memory-usage-on-linux) ?
Matt Welke avatar
cn flag
@Luuk No, but I just took a look at that now. The accepted answer states that `ps` shows memory usage in kibibytes and that the "resident size" is the amount of memory the process is actually using. Earlier, while researching before posting this question, I learned that the column `RSS` in `ps` output was the resident set size. So I concluded before posting this question that the processes were using those amounts of memory based on the `ps` output I saw from each VPS.
djdomi avatar
za flag
bedrock? is this a Minecraft server software?
Matt Welke avatar
cn flag
@djdomi Yes. The process I am running is the one you get when you download Minecraft (Bedrock Edition) from the Minecraft website. In the file downloaded, it's called `bedrock_server`, and you're instructed to run it with the command `LD_LIBRARY_PATH=. ./bedrock_server`.
djdomi avatar
za flag
Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on [su]
Matt Welke avatar
cn flag
@djdomi I thought that this kind of problem would be useful to know how to address when I'm running programs in a business environment too, like the applications that I create as a software developer. For example, if my team is aiming for low memory usage because we're creating applications meant to be run on Kubernetes, I'd want to know how to address this issue. That's why I made the question as generic as possible. I only specified the Minecraft related details in case someone wanted to go beyond the info I copy pasted into the question and try to reproduce it themselves.
Matt Welke avatar
cn flag
When I took a look at Super User while deciding where to post the question, it looked like the questions posted there were about people using software, not creating software. So I didn't think it would be a good fit. I figured if I posted there, someone might say "just use the OS that causes the process to use less memory", but that wouldn't solve my problem, which is that I want to understand why one OS is using less memory to run the process. Do you think this would be good for Stack Overflow despite it not having to do with writing code, since my perspective is that of a software developer?
Matt Welke avatar
cn flag
To clarify, the perspective I'm referring to is that of a software developer who has finished developing the software and is now tasked with running the software on a server they administer (or who is responsible for creating a Kubernetes pod image for the software). The description for Server Fault is "Q&A for system and network administrators", which is why I chose this one.
djdomi avatar
za flag
it's not what you choose. it must be about managing information technology systems in a business environment. this the fact, if you want to improve the code quality then stackoverflow.com is the right way
Matt Welke avatar
cn flag
Gotcha. Ty. I posted it on [Super User](https://superuser.com/questions/1802750/why-would-a-process-use-more-memory-running-on-one-os-compared-to-another) instead.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.