Max possible shared memory size in 64-bit Linux machine

10,692

the maximum shm memory size is available thru /proc/sys/kernel/shmmax and you could write into that pseudo-file to change it. It probably cannot be raised above some portion (e.g. half) of physical RAM. Perhaps some kernel configuration can change that.

You can also share memory with the mmap syscall with MAP_SHARED flag.

Share:
10,692
Baplix
Author by

Baplix

Updated on June 04, 2022

Comments

  • Baplix
    Baplix almost 2 years

    I have 64-bit Linux machine(Intel Xeon L5410 @ 2.33GHz).

    **meminfo:**
    MemTotal:     24672736 kB 
    MemFree:        145372 kB 
    Buffers:        181896 kB 
    Cached:       22004648 kB 
    SwapCached:     195072 kB 
    Active:        9761028 kB 
    Inactive:     13964532 kB 
    HighTotal:           0 kB 
    HighFree:            0 kB 
    LowTotal:     24672736 kB 
    LowFree:        145372 kB 
    SwapTotal:    17414452 kB 
    SwapFree:     15618852 kB 
    Dirty:         2125148 kB 
    Writeback:           0 kB 
    AnonPages:     1358396 kB 
    Mapped:        1069632 kB 
    Slab:           699464 kB 
    CommitLimit:  29750820 kB 
    Committed_AS:  9236252 kB 
    PageTables:      38620 kB 
    VmallocTotal: 34359738367 kB 
    VmallocUsed:     17272 kB 
    VmallocChunk: 34359718843 kB 
    HugePages_Total:     0 
    HugePages_Free:      0 
    HugePages_Rsvd:      0 
    Hugepagesize:     2048 kB 
    
    **Also the shm details are:**
    shmall                2097152 
    shmmax                3294967296 
    shmmni                4096 
    

    I am trying to create shared memory above 2 GB, shmget is successful but later core dump occurs with the error that cannot access memory. While shared memory below 2GB works perfectly fine. I am able to find any valid reason for this as my shmmax value is around 3GB

  • Ignacio Vazquez-Abrams
    Ignacio Vazquez-Abrams almost 12 years
    I believe you missed the last paragraph in the question.
  • Basile Starynkevitch
    Basile Starynkevitch almost 12 years
    Not entirely. I am suggesting to write into /proc/sys/kernel/shmmax (and it is not apparent that the OP tried that)