steam-for-linux icon indicating copy to clipboard operation
steam-for-linux copied to clipboard

Problem with /dev/shm

Open ltworf opened this issue 11 years ago • 7 comments

Let me begin saying that my dev/shm is unusually small. About 60MiB.

Steam client uses to fill it and after closing leaves some garbage behind, in that directory. That is in fact a memory leak.

The problem I meet is that some games (portal2, tf2) require more space in /dev/shm to start and just fail silently without starting when it is not available.

Providing some sort of error message would be nice. It would be even better if it could provide an indication of the actual problem.

Best

ltworf avatar Jun 25 '14 22:06 ltworf

Guess they could provide 'no space left on device' error, however it's not to say that they should fix your low /dev/shm, which is typically mounted as tmpfs (which by default has max size of 1/2 RAM). If you see some 'leftovers', you should probably report them in separate bugs (one per each game).

tpruzina avatar Jul 15 '14 10:07 tpruzina

Well my /dev/shm is so small so that leftovers won't end up taking half of my ram. And if you add-up the total default size of all tmpfs, it's about 150%-200% of the RAM.

ltworf avatar Jul 24 '14 08:07 ltworf

Leftovers in tmpfs typically are not a big deal (asuming you have swap), since tmpfs contents are typically swapped out first. Especially if these are unused for longer periods of time.

If you are not useing swap then it might be an issue (though I'm not defending 'leftover' files in /dev/shm).

tpruzina avatar Jul 24 '14 14:07 tpruzina

It all depends on how many programs leave leftovers there and how often you reboot. I normally don't reboot for weeks and certainly my swap isn't 2 times as big as my RAM.

ltworf avatar Jul 25 '14 07:07 ltworf

I can verify this is still a problem as of the date of this comment (8 years later!!!). I will run steam, play a game, close steam. Each time it creates about 10 shm-entries, each being around 11M in size, so around 100M each time. Since I will play games a few times per day this quickly will accumulate to rather large sums. Right now steam have allocated 5.6G in about 10 days. Please deallocate system resources upon exiting the steam client.

Edit: I think one possible solution would be to not use the naming scheme with random filenames, if it used the same filenames it would reuse the wasted resources at least.

Mikael-Lovqvist avatar Jul 04 '22 13:07 Mikael-Lovqvist

I tried to google how to find an app which creates but doesn't delete files from /dev/shm and I finally found it was steam. After each opening and closing steam 2 shm entries are leaked - u${user}-Shm_${hash} both 10485776 bytes. Both of them are used by ./steamwebhelper(most shm entries are used by /.steam/debian-installation/ubuntu12_32/steam, but they are not leaked) There are also 2 constant entries which are leaked once after first start stop and reused by next runs: u${user}-ValveIPCSharedObj-Steam and small u${user}-Shm_${hash} where hash is the same each time(even after deleting it's created with the same hash). hash of constantly leaked-once file is 1253xxxx(I'm not sure if it depends on user, last 4 hex digits are removed by me)

quant61 avatar Jul 17 '22 10:07 quant61

You really think they will ever fix this?

ltworf avatar Jul 18 '22 22:07 ltworf

can we be met halfway and at least put all this crap into its own pile (directory) to make cleanup easier?

radionaut avatar Feb 28 '24 23:02 radionaut

Same here. I had an issue of RAM filling up with long uptimes and it took me a while to realize that it was the shared memory, more specifically /dev/shm, and that steam/cs2 is responsible for it.

For now I'll just add some rm's to my steam startup command, but yeah Valve it's impolite not to clean up after yourselves...

You really think they will ever fix this?

It took them 10 years and a major upgrade to finally fix a simple keyboard mapping issue in Source on Linux... there's still hope... :facepalm:

qwenger avatar Mar 23 '24 15:03 qwenger