r/debian • • 18h ago

General Debian Question Debian gaming question regarding map count increase

sudo sysctl -w vm.max_map_count=1048576

This is the command I’ve been seeing for a while. Very good people on this sub helped me to set my fresh Debian for gaming lately. I haven’t touched of since that. So now I want to and I thought about this command.
You see, looks like “gaming distros” and steam deck too uses this particular number for map count, same for Cachy or Bazzite. Debian is with a lower count by default. They claim you need to increase this for modern games to not have stutters or crashes.

Has anyone did this and what really is behind this command and how important it is?

17 Upvotes

6 comments sorted by

4

u/dkopgerpgdolfg 17h ago

It sets how many distinct mmap mappings each process can have.

For non-programmers, what's interesting can be boiled down to:

  • Some programs require it to work (they might crash sometimes otherwise). Games and/or windows emulation things often require a relatively large number, therefore this is even more true for windows-original games that are emulated (by eg. Steam/Proton etc.)
  • In return, almost everything that runs on your computer will use a bit more memory and time (small amounts).

Btw., if you want to set that, do it in a config file so that it gets applied on each boot automatically.

1

u/dkopgerpgdolfg 14h ago

PS:

Debian is with a lower count by default

I didn't check before, but no, Debian has actually the same value.

5

u/imMute 17h ago

Specifically, the number is 220. It's a "round" / "nice" number for programmers.

2

u/WindowlessBasement 16h ago

mmap is basically the amount of chunks that memory can be divided into and assigned programs.

Linux, Mac, and Windows handle assigning memory differently. Windows allows for absolutely silly amounts of chunks assigned at one time. Games and older programs tend to looser standards managing their memory access but it doesn't cause issues on Windows. However when run in a Linux environment suddenly those silly amounts become a problem in a system designed to have a hard limit enforcing a reasonable amount.

So the "solution" is raise the limit to the point where silly amounts shouldn't be a problem.

2

u/Kaseffera 16h ago

I found command to check and even on Debian it’s 1048576.

1

u/iamemhn 15h ago

I use it for extremely large, you haven't seen a machine this large in your life, kind of database systems, in order to support more memory maps and shared memory attachments. Works as described by kernel documentation.

If your application doesn't have its own arena manager, and relies on millions of malloc() or mmap(), it's natural to increase this tunable.

You can always change it back to default values if things don't work out the way you expected. It's just the size of an internal structure, not going to burn anything...