Page 1 of 1

BoxBox collision algo crash in 2.62

Posted: Thu Oct 11, 2007 2:24 pm
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.

Re: BoxBox collision algo crash in 2.62

Posted: Thu Oct 11, 2007 2:32 pm
by pico
The problem seems to be identical to the problem described in post "Error in btPoolAllocator.h with alternative BoxBoxCollision"

Re: BoxBox collision algo crash in 2.62

Posted: Fri Oct 12, 2007 8:56 am
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

Re: BoxBox collision algo crash in 2.62

Posted: Fri Oct 12, 2007 10:32 am
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

Re: BoxBox collision algo crash in 2.62

Posted: Fri Oct 12, 2007 4:12 pm
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

Re: BoxBox collision algo crash in 2.62

Posted: Sat Oct 13, 2007 10:35 am
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.

Re: BoxBox collision algo crash in 2.62

Posted: Fri Dec 28, 2007 4:46 pm
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

Re: BoxBox collision algo crash in 2.62

Posted: Fri Dec 28, 2007 5:16 pm
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

Re: BoxBox collision algo crash in 2.62

Posted: Thu Jan 03, 2008 4:45 am
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

Re: BoxBox collision algo crash in 2.62

Posted: Thu Jan 03, 2008 12:19 pm
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