Bullet objects number limitation

mateas
Posts: 4
Joined: Sun Aug 11, 2013 10:24 pm

Bullet objects number limitation

Post by mateas »

Hi all,
I have recently stardted to work with Bullet and I found it great. Recently I was trying to simulate 10k of exactly identical balls, which share one collision shape (sphere), have the same mass but different positions. All of them are enclosed in a static box, just to limit their possible positions. I am applying random speeds to balls just to mix them in space. The problem I have encountered is that when I use around 8k balls simulation is initialized properly and work properly (I use multithreading solver and dispatcher), but when I increase balls number to 10k I get an exception:

Code: Select all

 	ntdll.dll!76fd15de() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]	
 	ntdll.dll!76fd15de() 	
 	ntdll.dll!76fc014e() 	
	 msvcr100d.dll!_unlock(int locknum)  Line 375	C
 	msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp)  Line 507 + 0x7 bytes	C++
 	msvcr100d.dll!_heap_alloc_dbg_impl(unsigned int nSize, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp)  Line 504 + 0xc bytes	C++
 	msvcr100d.dll!_nh_malloc_dbg_impl(unsigned int nSize, int nhFlag, int nBlockUse, const char * szFileName, int nLine, int * errno_tmp)  Line 239 + 0x19 bytes	C++
 	25a8dd68()	
 	Core.exe!btAllocDefault()  Line 24 + 0x9 bytes	C++
 	Core.exe!btAlignedAllocDefault()  Line 70 + 0x13 bytes	C++
 	00000010()	
 	00000010()	
 	Core.exe!btDbvtTreeCollider::Process()  Line 107 + 0x27 bytes	C++
 	Core.exe!btDbvtTreeCollider::Process(bool (QTableWidgetItem * const &) n)  Line 114	C++
 	Core.exe!btDbvt::collideTV<btDbvtTreeCollider>()  Line 949	C++
 	Core.exe!btDbvtBroadphase::createProxy()  Line 186	C++
 	Core.exe!btCollisionWorld::addCollisionObject()  Line 137 + 0x4c bytes	C++
 	Core.exe!btDiscreteDynamicsWorld::addCollisionObject()  Line 535	C++
 	Core.exe!btDiscreteDynamicsWorld::addRigidBody()  Line 595 + 0x1d bytes	C++
It looks strange to me, as firstly You can see that in

Code: Select all

Core.exe!btDbvtTreeCollider::Process(bool (QTableWidgetItem * const &) n)  Line 114 
there is some strange function parameter from Qt , which I indeed use, but Bullet is absolutely not dependent on that and I have no access to it (or I don`t call it explicitly), and later

Code: Select all

00000010()	
00000010()
that also suggest something wrong has happened to an error itself in

Code: Select all

Core.exe!btAllocDefault()  Line 24 + 0x9 bytes
This is the stack trace from Visual Studio 2010. Application and Bullet are compiled for x86. Both are dependent on the same c++ runtime.

Could anybody take a look on it? Is there some bullet internal limitation for number of primitive objects like speheres? Additionally, I am using

Code: Select all

btHashedOverlappingPairCache* pairCache = new btHashedOverlappingPairCache();
overlappingPairCache = new btDbvtBroadphase(pairCache);
where there might be the problem of size limit.

I would be very gratefull for any help. For now I have just limited number of objects to 8k but I have seen posts with simulations of more than 10k objects and I am confused right now what am I doing wrong or what might be the true problem.

Thanks in advance for any help,
Mateusz Janiak
mateas
Posts: 4
Joined: Sun Aug 11, 2013 10:24 pm

Re: Bullet objects number limitation

Post by mateas »

I have solved the problem on my own in Visual Studio 2010 for x86 builds with Project Property under Linker -> System -> Enable Large Addresses -> set to /LARGEADDRESSAWARE for my application. For x64 I think this problem should not happen.