2

I have an Intel 11700 with 4*32 GB RAM.

When 4 physical RAM slots are filled, BIOS, htop, sudo lshw, sudo dmidecode dmesg (whatever command I use to display the total RAM on the system) all display that I have 128 GB RAM.

However, I can only use 57.2 GB, i.e. approximately half of the available RAM.

I tested this by using malloc() in C and creating files in tmpfs. The former finally returns a NULL pointer, and the latter finally displays that the device is out of space.

More strangely, if I only install one or two RAM modules, i.e. 32 or 64 GB, I still can only use about half of the RAM, i.e. 12.1 or 28.7 GB.

3
  • @StephenKitt I configure it in the waysudo mount -t tmpfs -o size=80G tmpfs ~/tmp/ Commented Mar 24, 2023 at 10:05
  • 1
    What does sysctl vm.overcommit_memory show? If it’s not 0, what does sysctl vm.overcommit_ratio show? Commented Mar 24, 2023 at 11:21
  • 2
    @StephenKitt oh yes it works. I ask my apprentice and he tells me that he configured it as 2 and forgot to restore it. Thank you very much Commented Mar 27, 2023 at 4:32

1 Answer 1

3

Having malloc fail, especially at 50% occupation, is a symptom of strict allocations, i.e. disabled overcommit. This is controlled by the vm.overcommit_memory sysctl, and can be seen with

sysctl vm.overcommit_memory 

If that indicates 2, the kernel will prevent overcommits, so heap resizes, mmaps etc. will fail when allocating (rather than when the memory is actually used). The limit is set to swap plus vm.overcommit-kbytes or vm.overcommit-ratio (as a percentage of physical memory).

To get the behaviour you’re expecting, set vm.overcommit_memory to 0.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.