Random crash while looking at mass crowd characters

Hello,

we’ve encountered 2 random crashes while using City Sample Mass Crowd Plugin with low reproduction rate. It seems to happen randomly when there is a lot of characters on the screen, but it is more likely to happen when we force garbage collection every frame via `gc.ForceCollectGarbageEveryFrame 1`.

Call stacks point to either skeletal mesh or hair strands, but each time it is a different mesh so it seems to be unrelated to any specific asset.

Could you recommend what else could we try to either debug or solve this issue?

Regards,

Mateusz

[Attachment Removed]

Hi,

these random crashes may indicate memory management issues, especially when they occur more frequently with forced garbage collection enabled. When you run gc.ForceCollectGarbageEveryFrame 1, you are effectively shrinking the window of time that an object exists after it has become unreachable. If the crash occurs here, it means code is trying to access an object (like a SkeletalMeshComponent) that has been marked for destruction but not yet nullified.

You can try to temporarily disable the hairstrands or their groom bindings with r.HairStrands.Enable 0 and r.HairStrands.Binding.Enable 0 and see if that improves stability.

you can do a similar thing for the skeletal meshes

To prevent race conditions caused by the garbage collector, you can try setting gc.AllowParallelGC to 0.

You can also try to increase the verbosity level of LogHairStrands (with LogHairStrands Verbose) as they often reveal the last object touched before the crash.

Let me know if that works or if you have any follow-up questions.

Regards,

Sam

[Attachment Removed]