-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Marshal.AllocHGlobal alignment #33228
Comments
For Linux, the implementation calls malloc (LocalAlloc -> HeapAlloc -> PAL_malloc -> malloc). This is documented to be aligned as
So this property will also hold for For Linux/x64, alignment is |
Could you please submit documentation edit to make this clear now that you have found the answer?
Could you please create a new API proposal issue on this? FWIW, I am not sure whether it is a good idea to make it overload. I think it would need to be a new pair of alloc/free methods to make it implementable cross-platform (e.g. see last post in https://stackoverflow.com/questions/33696092/whats-the-correct-replacement-for-posix-memalign-in-windows). |
We know what it does on Linux now. We still need the answer for Windows. It may also be different on macOS (it uses something other than |
Created #33244 for API proposal. |
On Windows this function calls the Win32 API |
Superseded by #33244 |
Documentation doesn't specify the alignment of allocated memory returned by
Marshal.AllocHGlobal
. What is the expected alignment? Does it change based on machine bitness/OS?Perhaps it's interesting to have an overload that accepts alignment as an argument (cfr posix_memalign)?
cc @adamsitnik
The text was updated successfully, but these errors were encountered: