Paper2D Sprite Actor possible memory leak 4.21, 4.20, 4.19

Hi there,

It looks like there may be a memory leak in 4.19 and above (including the latest 4.21.0 release) when using the PaperSpriteActor using a sprite source from a spritesheet. Spawning Paper Sprite Actors into the scene and leaving the game running eventually fills up all the memory until an out of memory exception is thrown. The more sprite actors that are spawned, the faster memory is filled up.

I can confirm this memory leak does not occur in 4.18.3.
It does occur in versions 4.19.2, 4.20.3 and 4.21.0.

I can also confirm that the memory leak doesn’t happen when using Flipbooks. I created a Flipbook for each individual sprite, spawned 60 FlipbookActors into the level and there was no memory issue. So the issue seems to only be with PaperSpriteActors.

It can be easily reproduced as follows:

  1. Create a new empty project, new blank level.
  2. Import a Spritesheet. I used TexturePacker and imported .paper2dsprites and .png files.
  3. Drag a whole lot of sprites into the level (PaperSpriteActors should be spawned). Our test we used 60 actors.
  4. Package and leave the game running.

Nothing else was added to our test scene and no other settings changed from the default new project settings.
When running a MemReport at the start of the game, used memory was: 271.50mb.
30 minutes later the MemReport showed it to be: 600.56mb.
Leaving it running eventually crashed the game with an out of memory exception.

MemReport shows that the loaded textures, loaded Actors, UObjects all remained the same over the timeframe. Only thing that changed when diffing the report was the Memory Used.

If this helps, Texture Settings are:

Sprites are using TranslucentUnlitSpriteMaterial, but same occurs with MaskedUnlitSpriteMaterial.

Hope that is enough information regarding this.

Thank you!

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://epicsupport.force.com/unrealengine/s/

Thanks

This sounds identical the problem we are having. Is there an update to this?