You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is correct, but the Allocator neither by name nor description implies that it returns an aligned block of memory. It just happens to use the _aligned_malloc function.
I believe your memory allocater does not align memory properly.
https://github.com/TheCherno/Sparky/blob/master/Sparky-core/src/sp/system/Allocator.cpp
The Allocate method:
void* Allocator::Allocate(size_t size)
calls _aligned_malloc on line 24:
byte* result = (byte*)SP_ALLOC(actualSize);
then proceeds to misalign the memory on line 27 before returning it to the caller:
The alignment needs to take the size_t preamble into account to ensure that the pointer returned to the caller is properly aligned. For an example of doing this properly, see:
https://blog.molecular-matters.com/2012/08/27/memory-allocation-strategies-a-stack-like-lifo-allocator/
The text was updated successfully, but these errors were encountered: