remove some debug globals from third_party/bullet

There are some debug global variables that prevent using bullet safely on multi-threaded environments (tsan failures).

PATCH from marioprats@
This commit is contained in:
Jeffrey Bingham
2018-06-23 21:41:24 -07:00
parent 6b2cae1b1d
commit f2afb4af35
7 changed files with 10 additions and 68 deletions

View File

@@ -15,10 +15,6 @@ subject to the following restrictions:
#include "btAlignedAllocator.h"
int gNumAlignedAllocs = 0;
int gNumAlignedFree = 0;
int gTotalBytesAlignedAllocs = 0;//detect memory leaks
static void *btAllocDefault(size_t size)
{
return malloc(size);
@@ -163,9 +159,6 @@ void* btAlignedAllocInternal (size_t size, int alignment,int line,char* filen
// printf("big alloc!%d\n", size);
// }
gTotalBytesAlignedAllocs += size;
gNumAlignedAllocs++;
int sz4prt = 4*sizeof(void *);
@@ -190,7 +183,6 @@ int sz4prt = 4*sizeof(void *);
ret = (void *)(real);//??
}
printf("allocation %d at address %x, from %s,line %d, size %d (total allocated = %d)\n",allocId,real, filename,line,size,gTotalBytesAlignedAllocs);
allocId++;
int* ptr = (int*)ret;
@@ -204,7 +196,6 @@ void btAlignedFreeInternal (void* ptr,int line,char* filename)
void* real;
if (ptr) {
gNumAlignedFree++;
btDebugPtrMagic p;
p.vptr = ptr;
@@ -229,11 +220,6 @@ void btAlignedFreeInternal (void* ptr,int line,char* filename)
}
}
gTotalBytesAlignedAllocs -= size;
int diff = gNumAlignedAllocs-gNumAlignedFree;
printf("free %d at address %x, from %s,line %d, size %d (total remain = %d in %d non-freed allocations)\n",allocId,real, filename,line,size, gTotalBytesAlignedAllocs, diff);
sFreeFunc(real);
} else
@@ -246,7 +232,6 @@ void btAlignedFreeInternal (void* ptr,int line,char* filename)
void* btAlignedAllocInternal (size_t size, int alignment)
{
gNumAlignedAllocs++;
void* ptr;
ptr = sAlignedAllocFunc(size, alignment);
// printf("btAlignedAllocInternal %d, %x\n",size,ptr);
@@ -260,7 +245,6 @@ void btAlignedFreeInternal (void* ptr)
return;
}
gNumAlignedFree++;
// printf("btAlignedFreeInternal %x\n",ptr);
sAlignedFreeFunc(ptr);
}