Lime-3DS-Emulator
Lime-3DS-Emulator copied to clipboard
Memory leak
Is there an existing issue for this?
- [X] I have searched the existing issues
Affected Build(s)
2109
Description of Issue
When playing, the emulator has a small memory leak (about 1MB per second), which becomes an issue when in long sessions (for example, streaming). Tested in Pokemon Y 1.0 and Pokemon X 1.5. Latest Citra, latest Lime release, and even PabloMK7 build all present this issue.
Attached log uses vulkan renderer, though the issue is still present when using OpenGL. This is happening on Linux. I haven't tested on Windows. Log goes up to 1GB before closing the emu.
Expected Behavior
Citra's RAM not consuming my entire PC.
Reproduction Steps
Literally just opening a game and letting it run without doing anything else.
Log File
System Configuration
CPU: AMD Ryzen 5 7600 (12) @ 5.170GHz GPU/Driver: AMD 7600XT RAM: 32GB DDR5 OS: Arch Linux
Note to self: Check if perf_history has anything to do with this
Be sure to check out this same issue but on PabloMK7's repo, where there's a bit more info about it.
As @suDisdain previously discovered, the leak happens because libfaad expects NeAACDecClose to be called after NeAACDecInit. It seems to me like the proper way to fix it would be to reopen the decoder if we detect that the game is playing a new aac file.
I am not familiar, nor experienced enough with the code base to do that but as a workaround we can just run NeAACDecInit once since games don't seem to change sample rate or number of channels, although some games may brake.
I tested Pokemon X and also briefly Fire Emblem Echoes: Shadows of Valentia and both seem to work fine.