[Blueprint] Object Leaks: SplineComponent not clear BodySetup (Physics)

Problem:

  1. We have blueprint with SplineComponent which in ConstructScript spawning SplineMeshComponent (with StaticMesh with colliders)

When place blueprint at scene - we have 100,675 objects

  1. Trying to move last point of the SplineComponent to produce/reduce components

After some seconds we get a 103,981 object

  1. If add GarbageCollect at Construction script - all zombie objects will be collected but generegate huge lags when moving point

Whats going on:

  1. On move spline points - PostEditMove event rerun ConstructionScript and generate new segmnents
  2. When ConstructionScript add components - AddComponent call RegisterComponent which call USplineMeshComponent::OnCreatePhysicsState() . This function start create collision as BodySetup
  3. Before rerun ConstrctionScript (function AActor::RerunConstructionScripts()) - PostEditMove calling DestroyConstructedComponents() which clearing components!
  4. When function DestroyConstructedComponents() call DestroyComponent() - USplineMeshComponent has not overrided function DestroyComponent() or OnDestroy() or some else and not call USplineMeshComponent::DestroyBodySetup() which provide zombie BodySetup

Confirmation:

Coding some c++ script with UObject iterator which iterate all objects and get theirs classes and counting

Before - 380 instaces of UBodytSetup

After - 2444 instances of UBodySetup

Hello,

Thank you for your report. We’ve recently released a new method for bug reporting using a more structured form. Please take a look at the forum post linked below and submit your report using the new Bug Submission Form.

https://forums.unrealengine.com/unreal-engine/announcements-and-releases/1410408-unreal-engine-bug-submission-form

Have a great day