Changed AlignedAllocate to default to posix_memalign #738
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm in the process of implementing iOS support for Godot Jolt, and it turns out that
aligned_alloc
is only available on iOS >=13, as seen here. According to that header it also appears thataligned_alloc
is not available on macOS versions prior to 10.15 (Catalina).What is available however (also found in the link above) is
posix_memalign
.I figured instead of adding even more platform ifdef's to
AlignedAllocate
I would just simplify things a bit and always default toposix_memalign
on anything but Windows, as this seems to be available on Android as well. Although, I'm not sure how this change fares on that one blue platform.I ran
PerformanceTest
on macOS and saw no difference compared toaligned_allocate
.Also note that
posix_memalign
technically returns an error code, but seeing as how none of the other allocation functions had any error-handling I opted to just ignore it.