Lime-3DS-Emulator icon indicating copy to clipboard operation
Lime-3DS-Emulator copied to clipboard

Memory leak

Open Readek opened this issue 1 year ago • 2 comments
trafficstars

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

citra_log.txt

System Configuration

CPU: AMD Ryzen 5 7600 (12) @ 5.170GHz GPU/Driver: AMD 7600XT RAM: 32GB DDR5 OS: Arch Linux

Readek avatar Apr 15 '24 11:04 Readek

Note to self: Check if perf_history has anything to do with this

OpenSauce04 avatar May 16 '24 12:05 OpenSauce04

Be sure to check out this same issue but on PabloMK7's repo, where there's a bit more info about it.

Readek avatar May 16 '24 12:05 Readek

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.

SeppNel avatar Mar 18 '25 20:03 SeppNel