New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextureCache: Fix leaking TCacheEntry instances #7552

Merged
merged 1 commit into from Nov 9, 2018

Conversation

4 participants
@stenzek
Contributor

stenzek commented Nov 8, 2018

I only just noticed this when looking into Spongebob and Friends Unite, we never actually delete the TCacheEntry objects, both in the old invalidation path, and the new deferred EFB copy invalidation path.

In a fifolog for spongebob, we leak up to 500KB of memory per second. Pretty bad. After the change memory usage stays flat as you'd expect. I suspect there could be texture-heavy games which leak faster than this.

@JMC47

This comment has been minimized.

Contributor

JMC47 commented Nov 8, 2018

Fixes the huge memory leak in NSMBWii.

if (entry->pending_efb_copy_invalidated)
{
auto config = entry->texture->GetConfig();
texture_pool.emplace(config, TexPoolEntry(std::move(entry->texture)));
delete entry;

This comment has been minimized.

@degasus

degasus Nov 8, 2018

Member

Sorry, I don't get why you delete the texture here instead of adding it to the pool. Shouldn't we try as hard as possible to reuse those textures in the next frames?

This comment has been minimized.

@stenzek

stenzek Nov 8, 2018

Contributor

The texture is already returned to the pool in InvalidateTexture (I figured it'd be better to return it as soon as possible, rather than keeping it until the copy is flushed, when it won't be used). The TCacheEntry is just kept around to know the address where the deferred copy should be written to.

@delroth delroth merged commit e903d34 into dolphin-emu:master Nov 9, 2018

10 checks passed

default Very basic checks passed, handed off to Buildbot.
Details
lint Build succeeded on builder lint
Details
pr-android Build succeeded on builder pr-android
Details
pr-deb-dbg-x64 Build succeeded on builder pr-deb-dbg-x64
Details
pr-deb-x64 Build succeeded on builder pr-deb-x64
Details
pr-freebsd-x64 Build succeeded on builder pr-freebsd-x64
Details
pr-osx-x64 Build succeeded on builder pr-osx-x64
Details
pr-ubu-x64 Build succeeded on builder pr-ubu-x64
Details
pr-win-dbg-x64 Build succeeded on builder pr-win-dbg-x64
Details
pr-win-x64 Build succeeded on builder pr-win-x64
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment