Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is max size of shared memory segments limited on OS X? #41

Open
leofang opened this issue May 15, 2019 · 0 comments
Open

Is max size of shared memory segments limited on OS X? #41

leofang opened this issue May 15, 2019 · 0 comments

Comments

@leofang
Copy link
Collaborator

leofang commented May 15, 2019

On Mac OS X the default maximum size for each shared memory segment is 4MB:

leofang@Leos-MacBook-Pro:~/$ sysctl -A | grep shm
kern.sysv.shmmax: 4194304
kern.sysv.shmmin: 1
kern.sysv.shmmni: 32
kern.sysv.shmseg: 8
kern.sysv.shmall: 1024
machdep.pmap.hashmax: 21
security.mac.posixshm_enforce: 1
security.mac.sysvshm_enforce: 1
leofang@Leos-MacBook-Pro:~/$ ipcs -M
IPC status from <running system> as of Wed May 15 11:09:08 EDT 2019
shminfo:
	shmmax: 4194304	(max shared memory segment size)
	shmmin:       1	(min shared memory segment size)
	shmmni:      32	(max number of shared memory identifiers)
	shmseg:       8	(max shared memory segments per process)
	shmall:    1024	(max amount of shared memory in pages)

This will have to be considered if the reconstructed arrays are too large.

That being said, so far I don't find this causes any problem:

import posix_ipc
s1 = posix_ipc.SharedMemory('/xxx', flags=posix_ipc.O_CREAT, size=4194304+1) # 1 byte larger than maximum

Refs:
http://www.spy-hill.com/help/apple/SharedMemory.html
https://stackoverflow.com/questions/36595754/shared-memory-folder-in-mac-error-shm-invalid-argument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant