"not enough memory" lua panic ONLY in Linux, works on windows fine.

Hey, when I try to connect to my server it crashes in the Sending Client Info area. 63 other people (full, except my reserved slot) are on and playing without issue, so it’s not a server issue most likely.
This problem has only occoured since I’ve swapped to Linux and played GM through OpenGL. Due to the fact that I can’t really log anything extra (at least to my knowledge) I can’t give a lot more detail other than it crashes while joining my server. It doesn’t crash anywhere else.

If you have any idea what may be causing me to run out of memory on a card with 4GB video memory, let me know.
nvidia-settings reports the proper amount of RAM.

snip

Just to chip in, Lua panics have nothing to do with video RAM. Lua panics occur when your actual RAM run out (or you reach the limit of a 32 bit process). This shouldn’t be happening unless there’s bad code/addons on your server or you have measly amounts of RAM.

Well, I’m running x86_64 and I have 16GB of system memory. Turning video settings down resolved it.

This is an issue with pulseaudio.
user slarer has devised a fix for this below …

from his profile:
“gmod has like 6-16 pulseaudio pages either mapped from memfds or systemv shared memory, and they take up 64mb a pop.
/etc/pulse/daemon.conf and /etc/pulse/client.conf need to have shm-size-bytes set to something lower than 64 mebibytes, i set it to 8 (meb).
i don’t know if it is of any detriment to pulseaudio’s performance or sound quality, but they used up nearly a gigabyte of gmod’s limited 32-bit memory space.
the game is entirely unplayable on 2017’s fine darkrps unless you do this.”

[editline]19th October 2017[/editline]

On an unrelated note, may I ask what distro you are using?

i don’t believe it’s entirely related to pulseaudio, but pulseaudio is definitely a major contributing factor.
the memory pages take so much of the limited 32-bit address space that you run out of memory before you’re even playing on a majority of darkrps (and other large gamemodes) in 2017.
there are (probably) other contributing factors that windows just doesn’t deal with, but i don’t have time to stare at the memory maps gmod has while open and figure out what is causing them to be created, (it’s obviously not realistic to modify the game to use less memory) and we can really only hope to get the same memory usage the windows version has. (which, with making the pulseaudio pages smaller, we have basically achieved.)
on another note, pulseaudio is really bad, and someone should go on their ircs and tell them that. the amount of searching i had to do just to find out if that was an option (and, if i didn’t make it clear, the option is shm-size-bytes in /etc/pulse/client.conf and /etc/pulse/daemon.conf) was absurd. (not to mention that there was barely any explanation as to what pulseaudio would actually do when it has a smaller map of a memfd, which i still don’t have any knowledge of.)

[editline]19th October 2017[/editline]

while this isn’t wrong, it should be noted that higher video settings in gmod (specifically things like model detail[?] and texture detail, shader-oriented things should be negligible) have a definite impact on memory (the reason is somewhat obvious), you can test it by setting your video settings to the lowest possible, writing down the memory usage of the process (there’s only one that really matters), and setting texture detail to “very high”. your memory usage should jump up by ~250mb off of that alone.
gmod looks bad regardless, but note that the pulseaudio memory page size trick is of at least double the magnitude in impact.