Skip to content

Seems resolved a crash bug in SIngleFrameAllocator #438

@darktemplar216

Description

@darktemplar216

attachments.zip

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

  1. When SingleFrameAllocator is not large enough, the memory allocated by mBaseAllocator was not properly recorded.
  2. The alignment offset recording in SingleFrameAllocator::allocate seems to have issues.

HeapAllocator

  1. 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.

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions