Possible fixes for Memory leaks in BulletMultiThreaded

Post Reply
Sinsemilla
Posts: 4
Joined: Sun Sep 08, 2013 4:45 pm

Possible fixes for Memory leaks in BulletMultiThreaded

Post by Sinsemilla »

Hi,


First of all, i want to say that bullet is a great Library in my opinion, you guys are doing a really great job. :D

Unfortunately i had crashes with my application when i was implementing the multiple threads as shown in the App_MultiThreadedDemo. Because of this, i changed a few things in the BulletMultiThreaded library, which i want to give back.

- In btParallelConstraintSolver::~btParallelConstraintSolver(), at line 1159, i changed delete m_solverIO; into delete [] m_solverIO;
- In PosixThreadSupport.cpp, i changed the mainSemaphore from a static pointer, to a static sem_t variable.
The functions createSem and destroySem, do now have a sem_t pointer as argument, and do not allocate and delete on the heap. The deletion of the semaphore in destroySem caused the crash.

- Just before someone asks why, i removed the most printfs in PosixThreadSupport.cpp, because they felt rather annoying to me. :wink:

I hope i did this correctly without breaking things. All i can tell, is that at least Valgrind is showing 0 Errors now and my application doesnt crash anymore. :P
Attachments
PosixThreadSupport.h
(4.04 KiB) Downloaded 821 times
PosixThreadSupport.cpp
(8.39 KiB) Downloaded 840 times
btParallelConstraintSolver.cpp
(50.55 KiB) Downloaded 802 times
Post Reply