-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-83765: indicate the maximum amount of memory on macOS #138552
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
Conversation
Fixed following the suggestion python#83765 (comment)
memory block may be larger or equal to the size requested. | ||
When attaching to an existing shared memory block, | ||
the *size* parameter is ignored. | ||
On macOS, the maximum size of a shared memory block is 140256418463744 bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the very least please add some commas, but it might be more helpful to use a saner and more human readable unit:
On macOS, the maximum size of a shared memory block is 140256418463744 bytes. | |
On macOS, the maximum size of a shared memory block is 127 TiB (140,256,418,463,744 bytes). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it would be useful to add a reference to where this number comes from. I can't see anything on the linked issue mentioning it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thank you for your comment! This number has been computed this way: https://gist.github.com/nilleb/e60e7adbfe2afaf9d727231c59b01100
I have tested it on macOS Sequoia 15.6.1.
That is the best I can afford for the moment, I don't have access to older operating systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, if this is an experimentally found number we should remove it, there are no guarantees.
Instead, say something like 'the maximum size is around 120 TiB'.
However, I'm now less sure about including this warning in the documentation, given the limit doesn't come from a documented or well-known property of macOS, and could change without warning. cc @python/macos-team for thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Searching further, I have found this SO post https://stackoverflow.com/a/77078609
Where they mention 0x00007ffffe000000 that corresponds to 140737454800896 (so a bit more that the size I get).
This would be compatible with the fact that the memory for a python process is limited to 128TiB on a 64bits macOS OS (and hence the maximum allowed value depends on the memory already allocated by python itself).
I would propose to add a link to https://github.com/apple-oss-distributions/xnu/blob/xnu-8796.141.3/osfmk/mach/arm/vm_param.h#L137
And a paraphrase of the explanation above.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm wrong here but AFAICT, 127 TiB is not 140,256,418,463,744 bytes. Indeed 1 TiB is
Instead, I would rather say that the maximum amount of memory on a 64-bit architecture is upperbounded by mathjax
enabled, we can use the math
role, otherwise, you can write it down in full numbers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, here is a further commit for your review! (the math role seems to be available, thank you!)
Co-authored-by: Adam Turner <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to document this at all? It is platform specific and Apple will never ship hardware with anything approaching that much memory.
I don't think this is useful information for Python multiprocessing users to have.
FWIW other architectures have similar limits. The details of each aren't relevant here though.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
left a comment on the issue. a more generic "btw your platform has limits" at most could make sense, otherwise this is too specific for cpython docs. (probably do a another PR for that if you want it at all) |
@gpshead may I just suggest to close the mentioned issue? That might be misleading for other wannabe fixers. Thank you! |
Fixed following the suggestion #83765 (comment)
📚 Documentation preview 📚: https://cpython-previews--138552.org.readthedocs.build/