BoxBox collision algo crash in 2.62

Post Reply
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

BoxBox collision algo crash in 2.62

Post by pico »

Hi,

i think this is directly for Erwin.

Previously i used version 2.56. Now i upgraded to version 2.62. This problem is there since i upgraded.

The defaultConfiguration doesn't register the BoxBox algo. So i do.
When now two boxes collide there is an assertion here:
------------------------------------------
// from btPoolAllocator.h, line 63
void free(void* ptr)
{
if (ptr) {
btAssert((unsigned char*)ptr >= m_pool && (unsigned char*)ptr < m_pool + m_maxElements * m_elemSize);
------------------------------------------

Attached is a modified "basicDemo.cpp". It uses two boxes and registers the BoxBox algo.

Thanks for your help.
Attachments
BasicDemo.zip
(3.08 KiB) Downloaded 379 times
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: BoxBox collision algo crash in 2.62

Post by pico »

The problem seems to be identical to the problem described in post "Error in btPoolAllocator.h with alternative BoxBoxCollision"
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: BoxBox collision algo crash in 2.62

Post by Erwin Coumans »

Can you try out release candidate Bullet 2.63-RC1, and see if this helps?

http://www.bulletphysics.com/Bullet/php ... =18&t=1567

Thanks,
Erwin
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: BoxBox collision algo crash in 2.62

Post by pico »

Excellent. It works. Thanks alot!

When you currently prepare a new build then maybe you could look into the below issues aswell? They are only build depending and may be fixed very quickly:

-------------------------------
FILE:btAlignedAllocator.h
TODO:Line 24: Please add: "#include "stddef.h"
REASON:"size_t" is defined there. Some compilers will break if its not included.
-------------------------------
File: btQuickprof.h
TODO: Please add support for systems with no time routines
REASON: systems without <sys/time.h> will otherwise fail to build
-------------------------------
--REQUEST--
FILE: btAllignedAllocator.cpp
TODO: allow custom allocator instead of malloc/free
REASON: It would be very helpfull to set an own allocator and free routine. On console system often different memory pools have to be managed with different managers. The custom allocator could be initialy set to malloc/free to be backward compatible.

Thanks
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: BoxBox collision algo crash in 2.62

Post by Erwin Coumans »

pico wrote: -------------------------------
FILE:btAlignedAllocator.h
TODO:Line 24: Please add: "#include "stddef.h"
REASON:"size_t" is defined there. Some compilers will break if its not included.
size_t indeed gives multi-platform issues, I might revert to int, just to avoid such hassle. Is stddef.h always available on every platform/compiler?
File: btQuickprof.h
TODO: Please add support for systems with no time routines
REASON: systems without <sys/time.h> will otherwise fail to build
Do you have a suggestion how to fix the compile error for btQuickprof.h? I think <sys/time.h> is not always available either. Can you provide a fix for the platform you are refering to? Note that this is just used for the demos, and for the optional timings (which are disabled by default).
--REQUEST--
FILE: btAllignedAllocator.cpp
TODO: allow custom allocator instead of malloc/free
REASON: It would be very helpfull to set an own allocator and free routine. On console system often different memory pools have to be managed with different managers. The custom allocator could be initialy set to malloc/free to be backward compatible.
Good idea, we can set a callback for the memory allocator, that the user can override. I rather leave the btAlignedAlloc/btAlignedFree as it is, and add a check for such custom allocator. One extra check shouldn't hurt performance, the allocator shouldn't be called very frequent (that is what the pool/stack/object array allocators are for).

Can you assist with the time.h/size_t issue?
Erwin
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: BoxBox collision algo crash in 2.62

Post by pico »

Erwin Coumans wrote:
pico wrote: Can you assist with the time.h/size_t issue?
Erwin
Hi Erwin,

"stddef.h" is part of the ANSI C standard library. So any ANSI conform compiler should know this include. I think its safe to include within the bullet source.

Regarding "time.h" i will dig into to find a solution that will work on any system, even if there is no time support from the used compiler.
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: BoxBox collision algo crash in 2.62

Post by pico »

Erwin Coumans wrote:
pico wrote: -------------------------------
FILE:btAlignedAllocator.h
TODO:Line 24: Please add: "#include "stddef.h"
REASON:"size_t" is defined there. Some compilers will break if its not included.
size_t indeed gives multi-platform issues, I might revert to int, just to avoid such hassle. Is stddef.h always available on every platform/compiler?
Erwin
Hi Erwin,

i've seen you included "stddef.h" in Bullet 2.66. Unfortunately it has been included in "btAlignedAllocator.cpp" instead of "btAlignedAllocator.h".
As size_t is used in the ".h" file it is needed there. Could you please move it?

Thanks
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: BoxBox collision algo crash in 2.62

Post by pico »

pico wrote:
Erwin Coumans wrote:
pico wrote: Can you assist with the time.h/size_t issue?
Erwin
Hi Erwin,

attached is a modified "btquickprof.h" that 'solves' the missing "time.h" issue.

Now when BT_NO_PROFILE is defined the missing time function/struct is defined. Also "time.h" is no more included. So for compilers without "time.h" people need then to define BT_NO_PROFILE.

regards
Attachments
btQuickprof.zip
(2.57 KiB) Downloaded 354 times
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: BoxBox collision algo crash in 2.62

Post by Erwin Coumans »

If time.h is not available, can you try not to use btClock, and disable profiling?

In other words, please use the following defines in src/LinearMath/btQuickprof.h

#define BT_NO_PROFILE 1
//#define USE_BT_CLOCK 1

I just made some commits that fixes compilation, in case btClock is not used. So you need the latest SVN, or wait for Bullet 2.67 for those changes.
Thanks for the feedback, hope this helps,
Erwin
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: BoxBox collision algo crash in 2.62

Post by pico »

Erwin Coumans wrote:If time.h is not available, can you try not to use btClock, and disable profiling?

In other words, please use the following defines in src/LinearMath/btQuickprof.h

#define BT_NO_PROFILE 1
//#define USE_BT_CLOCK 1

I just made some commits that fixes compilation, in case btClock is not used. So you need the latest SVN, or wait for Bullet 2.67 for those changes.
Thanks for the feedback, hope this helps,
Erwin
Thanks i will try. I guess you have oversight my other posting above.
repost:

Hi Erwin,

i've seen you included "stddef.h" in Bullet 2.66. Unfortunately it has been included in "btAlignedAllocator.cpp" instead of "btAlignedAllocator.h".
As size_t is used in the ".h" file it is needed there. Could you please move it?

Thanks
Post Reply