std::bad_alloc on new btCollisionDispatcher

loefje
Posts: 18
Joined: Thu May 28, 2009 10:43 am

std::bad_alloc on new btCollisionDispatcher

Post by loefje »

hi,

after moving the physics code into a separate library of my project,
all of a sudden I get a bad alloc on "new btCollisionDispatcher( ... )"
my project setup in msvc2008 was this:

-"main project"
main.cpp <- calls s_config = new btDefaultCollisionConfiguration();
s_dispatcher = new btCollisionDispatcher( s_config );

-"tools.lib"
has nothing to do with bullet

and is now such:

-"main project"
main.cpp <- calls PhysicsWorld::initialize()
-"tools.lib"
PhysicsWorld.cpp <- implements initialize()

initialize does among other things:

// setup the collision config
s_config = new btDefaultCollisionConfiguration();

// use the default collision dispatcher
s_dispatcher = new btCollisionDispatcher( s_config );

which again, used to work fine. There's probably something wrong with the project settings of 'tools.lib', but they're pretty much identical to the 'main project'. can it be some kind of alignment issue or other ? The bad_alloc occurs on a 128 byte allocation in new(), so that suggests something very skewy. There isn't any pre-initialisation stuff for bullet that I need to do, right ?

I'll await any response before sending (too much) details.

thanks,

Jonathan Bacon
loefje
Posts: 18
Joined: Thu May 28, 2009 10:43 am

Re: std::bad_alloc on new btCollisionDispatcher

Post by loefje »

actually including ALL bullet files into my project eliminates the problem.
which is fine, but feels a bit strange. The compiler settings between the projects
were identical, I checked multiple times, so it remains a mystery why the bad_alloc
occured. anyway, this workaround solves the problem.

J