Memory leak from GraphicsMeshParts, Animations, and GraphicsTextures

Rep Steps:

In a new experience, add a script to SSS that changes the players animation to a new one every 15 seconds and prints the Memory usage for Animation.

Rep File:
CacheTest.rbxl (55.2 KB)

I’m experiencing an exponential raise in Memory coming from GraphicsMeshParts, Animations, and GraphicsTextures specifically related to players equipping and removing humanoidDescriptions

Expected behavior

I would expect the caches described earlier to be cleaned at least 30 minutes after the item is no longer needed, it’s understood that they would not be cleared immediately however after a certain amount of time it’s unlikely the mesh/texture/animation will be needed again (albeit the test only lasted 30 minutes, perhaps it takes longer. In my experience it takes too long and memory usage gets higher than I would like to see)

A private message is associated with this bug report

So I’ve looked into this for a bit and it works as in tended.

Note that the cache does not have a time limit. Basically there is a certain amount of memory (depending on total system memory) available that will be used for animation cache. Once this memory is exceeded the cache evicts animations that are no longer needed. If this limit is not exceeded then it’ll basically look like a full cache.

For my particular configuration it seems the limit is about 16/17MB. running your test case for ~15 minutes yields:

Running it for an hour still caps:

I hope this helps