malloc doesn't work inside Bullet

Post Reply
Yola
Posts: 10
Joined: Wed Oct 24, 2018 8:38 am

malloc doesn't work inside Bullet

Post by Yola »

I built Bullet for VS2017 as explained on github. I can run BulletExampleBrowser, but when i try to use it from my application I sometime have this stack trace inside Bullet, sometime other, but apparently something wrong with memory allocations.

Code: Select all

 BulletResearch-Debug.exe!heap_alloc_dbg_internal(const unsigned int size, const int block_use, const char * const file_name, const int line_number) Line 359	C++
 BulletResearch-Debug.exe!heap_alloc_dbg(const unsigned int size, const int block_use, const char * const file_name, const int line_number) Line 450	C++
 BulletResearch-Debug.exe!_malloc_dbg(unsigned int size, int block_use, const char * file_name, int line_number) Line 495	C++
 BulletResearch-Debug.exe!malloc(unsigned int size) Line 23	C++
>BulletResearch-Debug.exe!btAllocDefault(unsigned int size) Line 26	C++
 BulletResearch-Debug.exe!btAlignedAllocDefault(unsigned int size, int alignment) Line 66	C++
 BulletResearch-Debug.exe!btAlignedAllocInternal(unsigned int size, int alignment) Line 247	C++
 BulletResearch-Debug.exe!btDiscreteDynamicsWorld::btDiscreteDynamicsWorld(btDispatcher * dispatcher, btBroadphaseInterface * pairCache, btConstraintSolver * constraintSolver, btCollisionConfiguration * collisionConfiguration) Line 224	C++
Have i missed something?
ritzmax72
Posts: 3
Joined: Mon Apr 15, 2019 2:48 am

Re: malloc doesn't work inside Bullet

Post by ritzmax72 »

Bullet probably has a custom allocator written on top of malloc and new operator. This is for alignment and fast processing using SIMD instructions. Try disabling SIMD or just use custom allocator provided or align your allocated memory.
Post Reply