-
-
Notifications
You must be signed in to change notification settings - Fork 253
Description
The previous editing was lost, so I'll rewrite it simply. I encountered a bug that crashes after 1-4 hours of runtime. According to the dump, the crash occurs in CollapseDetectionSystem::reportContactsAndTriggers, specifically in reportDebugRenderingContacts(mCurrentContactPairs, mCurrentContactManifolds, mCurrentContactPoints, mLostContactPairs).
The issue lies with mLostContactPairs. Specifically, within OverlapCallback::OverlapPair getBody1, in BodyComponents::getBody(Entity bodyEntity), mMapEntityToComponentIndex[bodyEntity] fails to find a valid entry for bodyEntity. After reviewing, the issue might be related to SingleFrameAllocator. I made some modifications, and the system has been running for 24 hours without crashing. Here are the changes:
SingleFrameAllocator
- When SingleFrameAllocator is not large enough, the memory allocated by mBaseAllocator was not properly recorded.
- The alignment offset recording in SingleFrameAllocator::allocate seems to have issues.
HeapAllocator
- HeapAllocator::release may not guarantee the update: if (currentUnit->nextUnit == mFreeUnits) { mFreeUnits = currentUnit->nextUnit->nextFreeUnit; }.
Various XXXComponents,Though these issues are not currently causing crashes, they appear to be incorrectly implemented.
- Taking BodyComponents as an example, in BodyComponents::allocate, the released portion seems to be smaller by mAlignmentMarginSize compared to the allocated portion. However, since HeapAllocator::release does not care about the size, it hasn’t caused any problems.