DanielChappuis / reactphysics3d

Open source C++ physics engine library in 3D

Home Page:http://www.reactphysics3d.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HeapAllocator alignment

ZeunO8 opened this issue · comments

commented

In DynamicAABBTree.cpp on Line 59 the HeapAllocator is used to allocate some memory.

On android memory must be aligned to 4/8 bytes to prevent SIGBUS: Illegal Alignment. Currently I'm getting a memory address like 0xd0309f4a which is clearly not aligned to 4/8 bytes.

Can you make changes to the HeapAllocator such that it returns aligned pointers? That way I can get my Android port running.

commented

That or how do I override the HeapAllocator with my own Allocator which provides pointer alignment?

commented

I forked the respository and made quite a few edits to the code ro make sure mBaseAllocator is the only allocator used. It's probably not worthy of a PR. It would still be good to get HeapAllocator, PoolAllocator and SingleFrameAllocator returning aligned pointers so that your engine works on Android

Duplicate of #239

This is already fixed in the "develop" branch. This will be part of the next release of the library.
All memory allocations will be 16 bytes aligned.

This is now fixed in version v0.10.0 of the library. Thanks a lot for reporting the issue.