Box2D Forums

It is currently Sat May 18, 2013 5:41 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: assert on node capacity
PostPosted: Sat Nov 06, 2010 12:31 pm 
Offline

Joined: Thu Jul 29, 2010 12:04 pm
Posts: 11
The project i am working on asserts in b2DynamicTree.cpp

in the method AllocateNode : b2b2Assert(m_nodeCount == m_nodeCapacity)

Does this mean no more nodes or objects can be created?

thanks
c


Top
 Profile  
 
PostPosted: Sat Nov 06, 2010 12:33 pm 
Offline

Joined: Thu Jul 29, 2010 12:04 pm
Posts: 11
Do I need to increase the m_nodeCapacity from 16 to something else?

c


Top
 Profile  
 
PostPosted: Mon Nov 08, 2010 12:39 pm 
Offline

Joined: Thu Jul 29, 2010 12:04 pm
Posts: 11
Still havent had any luck. Can somebody from the box2d developers why this assertion occurs?

Thanks
c


Top
 Profile  
 
PostPosted: Mon Nov 08, 2010 4:57 pm 
Offline
Site Admin

Joined: Thu Sep 06, 2007 12:34 am
Posts: 2931
This assertion is occurring because the tree has become corrupt. You may have a buffer overflow or you are referencing memory that is out of scope. This is likely a bug in your code since I have never seen this assert trip before.

However, please try to reproduce the assertion in the C++ testbed and reply with the code that causes the assertion.


Top
 Profile  
 
PostPosted: Sun Jun 17, 2012 12:28 pm 
Offline

Joined: Sun Jun 17, 2012 12:06 pm
Posts: 1
Hello, I know this is an old thread, but it came up when I googled the assertion.

I had the same assertion. I made it go away by using the C++ operator "new" to allocate the b2World object pointer. I was using malloc before :). Guess what, I'm a C++ newbie. Depending on what I did with the world object, I was also getting the error message:
Quote:
test2012(5487,0xa06a1540) malloc: *** error for object 0x4c1f4c4: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

I guess that has fixed it. So next time someone complains about the assert, you can tell them not to be such a douche and use new instead of malloc.

Added info for random Googlers: I'm using Box2D in Xcode for ios. That's why I'm having to store a pointer, rather than just have the b2World as a normal member variable in a C++ class. Objective C++ only allows you to have a C++ class member variable in an objective C class if the C++ class has a default constructor (b2World doesn't have one), but there is no such restriction on pointers to C++ classes.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group