Skip to content

CDRIVER-4550 Do not use aligned_alloc() on Windows #1173

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

Merged
merged 1 commit into from
Jan 10, 2023
Merged

CDRIVER-4550 Do not use aligned_alloc() on Windows #1173

merged 1 commit into from
Jan 10, 2023

Conversation

jeroen
Copy link
Contributor

@jeroen jeroen commented Jan 6, 2023

@kalibera found that aligned_alloc is not in stdlib.h and it is not supported in Windows, despite that it is in C11. See the footnote in: https://learn.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance:

The Universal CRT doesn't implement C11 aligned_alloc, but does provide _aligned_malloc and _aligned_free. Because the Windows operating system doesn't support aligned allocations, this function is unlikely to be implemented."

Actually aligned_alloc() is also missing on MacOS 10.13 (which we also need) but I will patch that on my end because you are no longer offically supporting MacOS < 10.14.

Downstream issues here: jeroen/mongolite#247 and jeroen/mongolite#244

@eramongodb eramongodb self-assigned this Jan 9, 2023
@eramongodb eramongodb self-requested a review January 9, 2023 20:05
Copy link
Contributor

@eramongodb eramongodb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change should suffice as a short-term workaround for insufficient feature detection on Windows. Created CDRIVER-4549 as followup work to properly expand test coverage to include MSVC in C11 compatibility tests.

@eramongodb eramongodb requested a review from kevinAlbs January 10, 2023 15:28
Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution @jeroen.

@kevinAlbs kevinAlbs changed the title Do not use aligned_alloc() on Windows CDRIVER-4550 Do not use aligned_alloc() on Windows Jan 10, 2023
@kevinAlbs kevinAlbs merged commit c05a1a0 into mongodb:master Jan 10, 2023
@jeroen jeroen deleted the patch-1 branch January 10, 2023 16:20
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

Successfully merging this pull request may close these issues.

3 participants