Code Block kern.sysv.shmmax=268435456 kern.sysv.shmmin=1 #kern.sysv.shmmni=128 kern.sysv.shmseg=32 kern.sysv.shmall=65536
Setting shared memory in Catalina
Code Block <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>shmemsetup</string> <key>UserName</key> <string>root</string> <key>GroupName</key> <string>wheel</string> <key>ProgramArguments</key> <array> <string>/usr/sbin/sysctl</string> <string>-w</string> <string>kern.sysv.shmmax=268435456</string> <string>kern.sysv.shmmni=128</string> <string>kern.sysv.shmseg=32</string> <string>kern.sysv.shmall=65536</string> </array> <key>KeepAlive</key> <false/> <key>RunAtLoad</key> <true/> </dict> </plist>
Moreover, I am not sure when OSX stopped using the sysctl.conf file, but digging around my Mojave disk I found a plist file with the these same parameters; so the sysctl.conf must have been from a previous upgrade, and probably not even used under Mojave.
Apple is killing the macOS platform; slow painful death ☹️ It should not be this complicated to change simple OS parameters - I want to turn off Time Machine throttling (debug.lowpri_throttle_enabled=0) and swap (launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist).. I feel I shouldn't have to reboot into Recovery mode, disable SIP, reboot into Recovery mode again, mount encrypted OS drive, create plist file and set parameter and disable swap, enable SIP, reboot yet again - 30 minutes later on a good day? If Catalina wasn't bad enough - Big Sur sure is - after Apple drops support for Catalina, I am outta here unless some major simplicity improvements magically happens in the next few releases.. Like downloadable OS update dmg files - yet another very sad topic...Usability is gone and it is not for real developers any more - the platform is dead to me
If you need a lot of shared memory, use a memory-mapped file instead. Create a file, then call mmap on it with permissions PROT_READ | PROT_WRITE
and attributes MAP_FILE | MAP_SHARED
.
If you don't want the file to hang around in the filesystem, you can delete (unlink) it as soon as your process(es) have mapped it; the memory remains valid until the memory map is removed or all the processes exit.