PxShapes are created with a ref count of 1, and it is up to the caller to decrement this once the shape has been attached to an actor. There are a handful of places in the code in which this doesn't happen, leading to memory leaks.

Steps to Reproduce
  • Add the following in TermGamePhys() in PhysLevel.cpp, after if (GPhysXSDK != NULL) {
    uint32 shapes = GPhysXSDK->getNbShapes();
    UE_LOG(LogPhysics, Warning, TEXT("Physics was terminated with %d shapes remaining"), shapes);
  • create a new blank c++ project with no starter content
  • run development editor
  • create a landscape object with the default settings
  • shutdown UE4
    -> LogPhysics:Warning: Physics was terminated with 384 shapes remaining
    expect 0 shapes remaining

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-42733 in the post.

Login to Vote

ComponentUE - Simulation - Physics
Affects Versions4.15
Target Fix4.16
Fix Commit3350134
Main Commit3362661
CreatedMar 9, 2017
ResolvedMar 16, 2017
UpdatedApr 27, 2018
View Jira Issue