First, the code for memory leaking that I use under VC8 (the built-in one, it even detects leaks in constructors)
Code: Select all
//The MemoryLeak Detector
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
void main()
{
//...
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
//...
}
Code: Select all
Dispatcher=new btCollisionDispatcher();
Detected memory leaks!
Dumping objects ->
{1552} normal block at 0x00876080, 4 bytes long.
Data: <| > 7C 97 DE 00
{1551} normal block at 0x00877AE8, 400 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
Object dump complete.
The rest happens when I add bodies in the btDynamicsWorld. With just one dynamic object and heck load of static ones it gives
Dumping objects ->
{1614} normal block at 0x0199AFF8, 47 bytes long.
Data: < $ c > F8 AF 99 01 ED ED ED ED 24 00 00 00 BF 63 90 01
{1613} normal block at 0x0199AF88, 48 bytes long.
Data: < o > B8 6F DE 00 CD CD CD CD CD CD CD CD CD CD CD CD
{1597} normal block at 0x0199AAD8, 47 bytes long.
Data: < $ L > D8 AA 99 01 ED ED ED ED 24 00 00 00 AF 4C 90 01
{1596} normal block at 0x0199AA68, 48 bytes long.
Data: < o > B8 6F DE 00 CD CD CD CD CD CD CD CD CD CD CD CD
{1552} normal block at 0x00876080, 4 bytes long.
Data: <| > 7C 97 DE 00
{1551} normal block at 0x00877AE8, 400 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
Object dump complete.
As you can see, it includes the leaks from above. I'm hoping that one day these things are going to be solved because if one more error allocation happens (that belongs to me) I wouldn't know if it's from Bullet or if it's because of my buggy code so I have to turn off Bullet for those occasions and by turning it off the bug may not appear again so now I'm just crossing my fingers
Also, a few suggestions for the decrease of allocations on the user side, why not turn this
Code: Select all
Dispatcher=new btCollisionDispatcher();
Broadphase=new btSimpleBroadphase;
//default constraint solver
Solver=new btSequentialImpulseConstraintSolver;
DynamicsWorld=new btDiscreteDynamicsWorld(Dispatcher,Broadphase,Solver);
Code: Select all
into this
#define SIMPLE_DISPATCHER 0x001
#define COMPLEX_DISPATCHER 0x002
#define SIMPLE_BROADPHASE 0x010
#define COMPLEX_BROADPHASE 0x011
#define SIMPLE_SOLVER 0x100
#define COMPLEX_SOLVER 0x101
DynamicsWorld=new btDiscreteDynamicsWorld(SIMPLE_DISPATCHER,
SIMPLE_BROADPHASE,SIMPLE_SOLVER);
//then allocate them in the constructor for btDiscreteDynamicsWorld
But hey, you may probably say that allocations aren't the primary issue right now so... at least I said it